www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15776] New: symlink documentation wrong: "Relative paths are


          Issue ID: 15776
           Summary: symlink documentation wrong: "Relative paths are
                    relative to the current working directory"
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: timothee.cour2 gmail.com

doc says, for symlink(original, link):

Relative paths are relative to the current working directory, not the files
being linked to or from.

it should be:
link is relative to cwd (if relative), original is relative to link (if
relative), so that in the example below:

buildPath(link.dirName, original).buildNormalizedPath
=buildPath(`d01/pz2.txt`.dirName, `../z2.txt`).buildNormalizedPath
=`z2.txt` = actual location of original wrt cwd, which is != original.
(and this is still valid for directory symlinks)
Perhaps renaming original to original_wrt_link would make this more obvious

├── d01
└── z2.txt

std.file.symlink(`../z2.txt`, `d01/pz2.txt`)

├── d01
│   └── pz2.txt -> ../z2.txt
└── z2.txt

Mar 06 2016