Skip to content

Fixed Windows path inclusion errors by using path.normalize() instead of path.format(path.parse())#552

Open
linky00 wants to merge 2 commits into
inkle:masterfrom
linky00:windows-path-fix
Open

Fixed Windows path inclusion errors by using path.normalize() instead of path.format(path.parse())#552
linky00 wants to merge 2 commits into
inkle:masterfrom
linky00:windows-path-fix

Conversation

@linky00
Copy link
Copy Markdown

@linky00 linky00 commented May 10, 2026

Fixes #551

path.format(path.parse()) seems to only fix Windows paths up to one layer deep. path.normalize() solves this issue on Windows.

This is untested on other platforms! Please check this doesn't break file creation on a POSIX system before merging.

@linky00
Copy link
Copy Markdown
Author

linky00 commented May 10, 2026

Hmm, newly created files still show up in 'Unused files' until a restart. Let me see if I can squish that too. (Though they don't show up twice, which I'm betting is the cause of the saving issues.)

@linky00
Copy link
Copy Markdown
Author

linky00 commented May 10, 2026

Okay I've solved this by having InkFile store stuff like relPath, projectDir, and its includes as already normalized paths. This is I think the most elegant solution? It also means I can skip the more band-aid-y solution in refreshIncludes.

I've also made sure to not modify new paths inputed into addNewInclude any more than you already were, so if you input a POSIX-style path you still get it as such in your main ink file (honestly I think this should force a POSIX-style path). Notably I'm bypassing the InkFile.relativePath() function to do so, BUT relPath only has any transformations if this is an absolute path and adding absolute paths appears to be broken anyway (who would want to create an include via an absolute path anyway???).

Once again please test this on a POSIX system first!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Paths more than one dir deep are 'Unused files' on Windows and save inconsistently

1 participant