From 5895c160c466c0a97716ffdf5ef654eb1c3c6009 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 7 Jul 2003 09:25:26 +0000 Subject: * Make dbRefs a mapping from Hash to [Path]. --- src/util.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/util.cc') 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; } -- cgit 1.4.1