about summary refs log tree commit diff
path: root/src/util.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-07-07T09·25+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-07-07T09·25+0000
commit5895c160c466c0a97716ffdf5ef654eb1c3c6009 (patch)
tree8e2756dd75b785f550c00538e4b97570d6a4c1c6 /src/util.cc
parent609a224848dd08cea35a89b03b64274c82f0a2a7 (diff)
* Make dbRefs a mapping from Hash to [Path].
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/util.cc b/src/util.cc
index 65ceea938352..2f9c43e55ce5 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -33,13 +33,18 @@ string absPath(string path, string dir)
             dir = buf;
         }
         path = dir + "/" + path;
-        /* !!! canonicalise */
-        char resolved[PATH_MAX];
-        if (!realpath(path.c_str(), resolved))
-            throw SysError(format("cannot canonicalise path %1%") % path);
-        path = resolved;
     }
-    return path;
+    return canonPath(path);
+}
+
+
+string canonPath(const string & path)
+{
+    char resolved[PATH_MAX];
+    if (!realpath(path.c_str(), resolved))
+        throw SysError(format("cannot canonicalise path `%1%'") % path);
+    /* !!! check that this removes trailing slashes */
+    return resolved;
 }