Skip to content

fix(projects): a project named NUL or CON gets a folder Windows can write in - #496

Merged
jub0t merged 1 commit into
jub0t:mainfrom
Bortlesboat:fix/device-name-project-folder
Oct 22, 2026
Merged

jub0t merged 1 commit into
jub0t:mainfrom
Bortlesboat:fix/device-name-project-folder

Conversation

@Bortlesboat

Copy link
Copy Markdown
Contributor

What does this PR do?

Creating a project named nul fails on Windows with "could not write ...\nul\concat.json: The system cannot find the path specified". folder_name already cleans out the characters Windows refuses and the trailing dots/spaces, but device names went through unchanged. Windows reports create_dir_all on ...\nul as 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 from folder_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, so nul becomes _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 from create) and pass with the change. Rest of concat-host passes here except cards::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 --check passes (for this crate; concat/src/platform.rs has a pre-existing diff on main)
  • cargo clippy --all-targets -- -D warnings passes (concat-host)
  • cargo test passes (concat-host, apart from the GPU test above)
  • python3 scripts/locales.py run (if UI text changed) - no UI text changed
  • New source files have a licence header - no new files

…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
Bortlesboat force-pushed the fix/device-name-project-folder branch from a4394f6 to e737cf8 Compare October 21, 2026 14:15
@jub0t

jub0t commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Let me look into it.

image

@jub0t
jub0t merged commit 144d4bf into jub0t:main Oct 22, 2026
1 check passed
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