[Issue 15776] symlink documentation wrong: "Relative paths are relative to the current working directory"

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Mar 6 23:21:22 PST 2016


https://issues.dlang.org/show_bug.cgi?id=15776

Timothee Cour <timothee.cour2 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timothee.cour2 at gmail.com

--- Comment #1 from Timothee Cour <timothee.cour2 at gmail.com> ---
(In reply to Timothee Cour from comment #0)
> 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
> 
> 
> tree
> .
> ├── d01
> └── z2.txt
> 
> std.file.symlink(`../z2.txt`, `d01/pz2.txt`)
> 
> .
> ├── d01
> │   └── pz2.txt -> ../z2.txt
> └── z2.txt


Also, docs should specify precisely what happens when link ends with a '/'

--


More information about the Digitalmars-d-bugs mailing list