Repository navigation
fix(projects): a project named NUL or CON gets a folder Windows can write in - #496
Merged
Merged
Conversation
…rite in folder_name already strips the characters Windows refuses and the dots and spaces it drops from the end of a name, but a device name came through as it was. A project called "nul" then got a folder Windows reports as made and refuses to put concat.json in, so creating it failed. On Windows 10 CON, PRN, AUX, COM1-9 and LPT1-9 do the same. Such a name now gets a leading underscore for its folder; the project keeps the name it was given. Signed-off-by: Andrew Barnes <169967362+Bortlesboat@users.noreply.github.com>
Bortlesboat
force-pushed
the
fix/device-name-project-folder
branch
from
October 21, 2026 14:15
a4394f6 to
e737cf8
Compare
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What does this PR do?
Creating a project named
nulfails on Windows with "could not write ...\nul\concat.json: The system cannot find the path specified".folder_namealready cleans out the characters Windows refuses and the trailing dots/spaces, but device names went through unchanged. Windows reportscreate_dir_allon...\nulas a success, then nothing can be written inside it. On Windows 10 the same happens for CON, PRN, AUX, COM1-9 and LPT1-9 (Windows 11 only kept NUL as a device in my testing). Since the export file name also comes fromfolder_name, an export of such a project would go to the device too.Now a device name (checked on the part before the first dot, case-insensitively, like Windows does) gets a leading
_for its folder, sonulbecomes_nul. The project's own name is untouched, and names that only start like a device (Console,COM10) are left alone.How to test
cargo test -p concat-host --lib projects::on Windows. The two new tests fail on main ("NUL"vs"_NUL", and the os error 3 above fromcreate) and pass with the change. Rest of concat-host passes here exceptcards::tests::every_card_draws_and_shows_its_package_at_work, which fails the same way on main on my machine (GPU device lost). clippy is clean for concat-host.Checklist
cargo fmt --checkpasses (for this crate;concat/src/platform.rshas a pre-existing diff on main)cargo clippy --all-targets -- -D warningspasses (concat-host)cargo testpasses (concat-host, apart from the GPU test above)python3 scripts/locales.pyrun (if UI text changed) - no UI text changed