diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-07-07T09·25+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-07-07T09·25+0000 |
commit | 5895c160c466c0a97716ffdf5ef654eb1c3c6009 (patch) | |
tree | 8e2756dd75b785f550c00538e4b97570d6a4c1c6 /src/util.cc | |
parent | 609a224848dd08cea35a89b03b64274c82f0a2a7 (diff) |
* Make dbRefs a mapping from Hash to [Path].
Diffstat (limited to 'src/util.cc')
-rw-r--r-- | src/util.cc | 17 |
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; } |