1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-26 12:10:59 +01:00

Created commit shell script; next adding nix-state

This commit is contained in:
Wouter den Breejen 2007-05-24 15:08:12 +00:00
parent 97eb8c32a0
commit c9e78a973a
5 changed files with 195 additions and 5 deletions

View file

@ -439,13 +439,18 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
if (!matchAttrRHS(staterhs, statevalue, statepos)) abort();
startNest(nest, lvlVomit, format("processing statedir attribute `%1%'") % statekey);
try {
string s = coerceToString(state, statevalue, context, true);
string s = trim(coerceToString(state, statevalue, context, true));
if (statekey == "dir") {
//Add a / to the end if it's not there
if(s[s.length() - 1] != '/')
dir.path = s + "/";
else
dir.path = s;
s = s + "/";
//Remove the / at the beginning if it's there
if(s[0] == '/')
s = s.substr(1, s.length());
dir.path = s;
}
else if (statekey == "type") { dir.type = s; }
else if (statekey == "interval") { dir.interval = s; }