diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-06-09T13·52+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-06-09T13·52+0000 |
commit | b0e92f6d474ce91d7f071f9ed62bbb2015009c58 (patch) | |
tree | c3d28be6b89dfa618df290d5c78c55897b119b6c /src/libutil | |
parent | 4ed01ed791b3bb7a4010049c6128aa2d49a81a29 (diff) |
* Merged the no-bdb branch (-r10900:HEAD
https://svn.nixos.org/repos/nix/nix/branches/no-bdb).
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/util.cc | 5 | ||||
-rw-r--r-- | src/libutil/util.hh | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index f978856a96cc..e18f9841fd4d 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -361,9 +361,10 @@ Path createTempDir(const Path & tmpRoot, const Path & prefix, Paths createDirs(const Path & path) { - if (path == "/") return Paths(); - Paths created = createDirs(dirOf(path)); + Paths created; + if (path == "/") return created; if (!pathExists(path)) { + created = createDirs(dirOf(path)); if (mkdir(path.c_str(), 0777) == -1) throw SysError(format("creating directory `%1%'") % path); created.push_back(path); diff --git a/src/libutil/util.hh b/src/libutil/util.hh index d75002b021d3..d52ab3e4d920 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -12,6 +12,10 @@ namespace nix { +#define foreach(it_type, it, collection) \ + for (it_type it = collection.begin(); it != collection.end(); ++it) + + /* Return an environment variable. */ string getEnv(const string & key, const string & def = ""); |