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

Fixed backwards compatible hack & added state creation call after build

This commit is contained in:
Wouter den Breejen 2007-05-22 13:19:27 +00:00
parent 73995157e3
commit 86b053dd80
5 changed files with 67 additions and 16 deletions

View file

@ -974,5 +974,38 @@ string bool2string(const bool b)
return "false";
}
bool string2bool(const string & s)
{
if(s == "true")
return true;
else if(s == "false")
return false;
else{
throw Error(format("cannot convert string: `%1%' to bool") % s);
quickExit(1);
return false;
}
}
string triml(const string & s) {
string news = s;
int pos(0);
for ( ; news[pos]==' ' || news[pos]=='\t'; ++pos );
news.erase(0, pos);
return news;
}
string trimr(const string & s) {
string news = s;
int pos(news.size());
for ( ; pos && news[pos-1]==' ' || news[pos]=='\t'; --pos );
news.erase(pos, news.size()-pos);
return news;
}
string trim(const string & s) {
return triml(trimr(s));
}
}