aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-06-09 13:52:45 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-06-09 13:52:45 +0000
commitb0e92f6d474ce91d7f071f9ed62bbb2015009c58 (patch)
treec3d28be6b89dfa618df290d5c78c55897b119b6c /src/libutil
parent4ed01ed791b3bb7a4010049c6128aa2d49a81a29 (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.cc5
-rw-r--r--src/libutil/util.hh4
2 files changed, 7 insertions, 2 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index f978856a9..e18f9841f 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 d75002b02..d52ab3e4d 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 = "");