Skip to content

Fix temp dir location for cross-drive hardlink failures on Windows#15

Merged
RenanGBarreto merged 1 commit into
PSBrew:mainfrom
cherryduck:fix-temp-windows
Jun 3, 2026
Merged

Fix temp dir location for cross-drive hardlink failures on Windows#15
RenanGBarreto merged 1 commit into
PSBrew:mainfrom
cherryduck:fix-temp-windows

Conversation

@cherryduck
Copy link
Copy Markdown
Contributor

On Windows, hardlinks cannot cross drives (WinError 17) and symlinks require the 'Create Symbolic Links' privilege (WinError 1314), which most users lack. Previously, when the source file and temp folder were on different drives, both linking strategies would fail.

Detect cross-drive scenarios by comparing st_dev of source and temp folder. When they differ, create the staging directory next to the source file so the hardlink succeeds. When on the same drive, respect the user's temp_folder preference.

On Windows, hardlinks cannot cross drives (WinError 17) and symlinks
require the 'Create Symbolic Links' privilege (WinError 1314), which
most users lack. Previously, when the source file and temp folder were
on different drives, both linking strategies would fail.

Detect cross-drive scenarios by comparing st_dev of source and temp
folder. When they differ, create the staging directory next to the
source file so the hardlink succeeds. When on the same drive, respect
the user's temp_folder preference.
@RenanGBarreto
Copy link
Copy Markdown
Contributor

Thank you very much for the PR, @cherryduck . I will merge it and soon I will release a new version of mkpfs with this bugfix.

@RenanGBarreto RenanGBarreto merged commit 69a4ea5 into PSBrew:main Jun 3, 2026
@RenanGBarreto RenanGBarreto self-assigned this Jun 3, 2026
@RenanGBarreto RenanGBarreto added bug Something isn't working and removed bug Something isn't working labels Jun 3, 2026
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.

2 participants