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

* An quick and dirty hack to support distributed builds.

This commit is contained in:
Eelco Dolstra 2004-05-12 09:35:51 +00:00
parent c8d3882cdc
commit 8c0b42f857
9 changed files with 92 additions and 13 deletions

View file

@ -29,6 +29,13 @@ SysError::SysError(const format & f)
}
string getEnv(const string & key, const string & def)
{
char * value = getenv(key.c_str());
return value ? string(value) : def;
}
Path absPath(Path path, Path dir)
{
if (path[0] != '/') {
@ -206,8 +213,7 @@ void makePathReadOnly(const Path & path)
static Path tempName()
{
static int counter = 0;
char * s = getenv("TMPDIR");
Path tmpRoot = s ? canonPath(Path(s)) : "/tmp";
Path tmpRoot = canonPath(getEnv("TMPDIR", "/tmp"));
return (format("%1%/nix-%2%-%3%") % tmpRoot % getpid() % counter++).str();
}