www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9530] New: std.path should have a function for getting the canonical path to a file or directory

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9530

           Summary: std.path should have a function for getting the
                    canonical path to a file or directory
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: jmdavisProg gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg gmx.com> 2013-02-17 23:12:56
PST ---
Take this example from std.path.absolutePath:

assert (absolutePath("../file", "/foo/bar")    == "/foo/bar/../file");

Note the ../ in the path. absolutePath does note return the canonical path
(which is what I would have expected it to do), but even if it's better for
absolutePath to not return the canonical path, we still need a function which
will do that, and I don't see one in std.path which does.

So, I think that either absolutePath should be changed to return the canonical
path (which presumably it has a good reason for not doing), or std.path needs a
new function which does.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 17 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9530



--- Comment #1 from Jonathan M Davis <jmdavisProg gmx.com> 2013-02-18 22:35:54
PST ---
Okay, it looks like we already have buildNormalizedPath which does some of what
needs to be done for canonicalizing a path (it gets rid of ., .., and / from a
path), but it doesn't follow symlinks, so it doesn't actually get a canonical
path (every file should have one and only one canonical path). So, this request
isn't quite as critical as I was thinking that it was, but we do still need a
function for returning the canonical path of a file or directory.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 18 2013