haxe icon indicating copy to clipboard operation
haxe copied to clipboard

Path.normalize(): wrong interpretation of double forward slashes

Open MoritzBrueckner opened this issue 3 years ago • 0 comments

Double forward slashes in paths seem to be interpreted as directories with empty names in haxe.io.Path.normalize():

class Test {
  static function main() {
    trace("Have:", haxe.io.Path.normalize("ProjectDir/Sources//../Assets"));
    // Have: ProjectDir/Sources/Assets
    trace("Want:", "ProjectDir/Assets");
  }
}

Try it online

The double forward slashes should be reduced to a single one and only then ../ should be evaluated. I'm a bit unsure whether the current situation is by design, but Python's os.path.normpath() for example works like intended with this example (have == want).

MoritzBrueckner avatar Aug 28 '22 14:08 MoritzBrueckner