Skip to content

Fix parent directory creation for absolute POSIX paths#9777

Merged
LocalIdentity merged 1 commit intoPathOfBuildingCommunity:devfrom
meehl:absolute-posix-paths
Apr 18, 2026
Merged

Fix parent directory creation for absolute POSIX paths#9777
LocalIdentity merged 1 commit intoPathOfBuildingCommunity:devfrom
meehl:absolute-posix-paths

Conversation

@meehl
Copy link
Copy Markdown
Contributor

@meehl meehl commented Apr 18, 2026

The [^/]+/ match pattern requires at least on non-slash character before the trailing slash. This works on Windows where absolute paths start with a drive letter.

With absolute POSIX paths, the leading slash is skipped by this pattern causing the accumulated dirStr to not start with a slash. dirStr is then interpreted as a relative path, causing the directories to be erroneously created in the current working directory.

This change fixes the erroneous behavior with absolute POSIX paths by initializing dirStr with a slash if the fullPath starts with a slash. It retains the current behavior on Windows systems.

The `[^/]+/` match pattern requires at least on non-slash character
before the trailing slash. This works on Windows where absolute paths
start with a drive letter.

With absolute POSIX paths, the leading slash is skipped by this pattern
causing the accumulated `dirStr` to not start with a slash. `dirStr` is
then interpreted as a relative path, causing the directories to be
erroneously created in the current working directory.

This change fixes the erroneous behavior with absolute POSIX paths by
initializing `dirStr` with a slash if the `fullPath` starts with a
slash. It retains the current behavior on Windows systems.
@meehl
Copy link
Copy Markdown
Contributor Author

meehl commented Apr 18, 2026

Same change can be applied to be PoB2 repo.

@meehl
Copy link
Copy Markdown
Contributor Author

meehl commented Apr 18, 2026

@stevschmid you might be interested in this since you had to apply the same patch to make the macOS port work.

@LocalIdentity LocalIdentity added technical Hidden from release notes pob2 Label for features that should be ported over to PoB-PoE2 labels Apr 18, 2026
@LocalIdentity LocalIdentity merged commit dc13ca6 into PathOfBuildingCommunity:dev Apr 18, 2026
3 checks passed
github-actions bot pushed a commit to PathOfBuildingCommunity/PathOfBuilding-PoE2 that referenced this pull request Apr 18, 2026
@stevschmid
Copy link
Copy Markdown

@meehl Thanks! Great change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pob2 Label for features that should be ported over to PoB-PoE2 technical Hidden from release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants