HaxeFoundation / HaxeFoundation/haxe

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

Open
#10,786 2 comments 3 reactions 1 assignee Claimed by @haxiomic View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

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

```haxe
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](https://try.haxe.org/#F8AC8d8e)

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).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.