www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13825] New: relativePath not handling "." and ".." correctly

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

          Issue ID: 13825
           Summary: relativePath not handling "." and ".." correctly
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: cromfr gmail.com

It seems that relativePath handles "." and ".." as folders names instead of
using them as "paths".
This leads to situations like "/home/../" is a subdirectory of "/home"



Use case:

import std.path;
import std.stdio;

void main(){
    //Gives ".." instead of "."
    writeln( relativePath("/", "/./") );

    //Gives "../.." instead of "."
    writeln( relativePath("/home", "/home/../home") );
}

--
Dec 06 2014