Skip to content

fix: render paths with forward slashes on windows - #465

Merged
chloe41427[bot] merged 1 commit into
masterfrom
fix/windows-forward-slash-paths
Oct 24, 2026
Merged

chloe41427[bot] merged 1 commit into
masterfrom
fix/windows-forward-slash-paths

Conversation

@chloe41427

@chloe41427 chloe41427 Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Windows binaries must print paths with forward slashes, as on Unix. SDKMAN runs on Windows under a Unix-like shell, so backslashes have no place in its output. #461 started rendering paths with Path::display(), which uses \ on Windows. That broke the home output and the paths in error messages.

  • Adds ui::slashed, which renders a path with / on every platform. It only replaces separators on Windows, because \ is a legal filename character on Unix.
  • home prints its path through ui::slashed.
  • ui::path, used for paths in messages, goes through ui::slashed.
  • Tests expect / again: this reverts the native-separator assertion from a390df9 in tests/helpers.rs. tests/home.rs normalises the temp SDKMAN_DIR it compares against.
  • Adds a unit test for ui::slashed.

Supersedes #464, which changed the tests to accept backslashes.

Test plan

  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test (Linux arm64)
  • Windows: pull_request.yml runs on pull_request_target and builds master, not this branch, so the push build on master after the merge is the Windows verification.

Signed-off-by: Chloe41427[bot] <chloe@sdkman.io>
@chloe41427
chloe41427 Bot merged commit a36f023 into master Oct 24, 2026
4 of 5 checks passed
@chloe41427
chloe41427 Bot deleted the fix/windows-forward-slash-paths branch October 24, 2026 00:43
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.

1 participant