1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 12:41:15 +02:00

Support URLs in $NIX_PATH

This didn't work (despite claims in the manual), because the colon in
"http://" was parsed as a element separator. So handle "://"
specially.
This commit is contained in:
Eelco Dolstra 2015-06-17 16:20:11 +02:00
parent 0d4d92fcf9
commit 65f17cd330
3 changed files with 32 additions and 1 deletions

View file

@ -1095,6 +1095,20 @@ string trim(const string & s, const string & whitespace)
}
string replaceStrings(const std::string & s,
const std::string & from, const std::string & to)
{
if (from.empty()) return s;
string res = s;
size_t pos = 0;
while ((pos = res.find(from, pos)) != std::string::npos) {
res.replace(pos, from.size(), to);
pos += to.size();
}
return res;
}
string statusToString(int status)
{
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {