Skip to content

Print a Windows home path with a tilde (windows-portability.md §7.2) - #192

Merged
ninjudd merged 4 commits into
mainfrom
windows/paths
Oct 11, 2026
Merged

ninjudd merged 4 commits into
mainfrom
windows/paths

Conversation

@ninjudd

@ninjudd ninjudd commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

field export prints where each file landed with your home folder shortened to ~, but homeRelative looked for the home path followed by /. On Windows the separator is \, so no path ever matched, and every export printed its full C:\Users\… path. The Windows portability sweep listed this as a standalone item in windows-portability.md §7.2.

homeRelative now takes the platform's separator, defaulting to path.sep, so a Windows path under the profile prints as ~\Desktop\…. Windows paths compare without regard to case, as Windows itself does, so --to c:\users\me\Music shortens like C:\Users\me\Music; only the prefix of the home path's length is compared, so the rest is sliced at the same place, and it prints as you gave it. The rule that a sibling folder such as C:\Users\justinx is not home still holds. On macOS and Linux the separator is / and the comparison keeps case, as before. The OneDrive-redirected Desktop, the other half of that item, stays the cosmetic wart the plan calls it: the export still lands there and prints its path.

The same §7.2 item for finding sclang on Windows was here too at first, and I took it out. Justin's #186, opened earlier, fixes it with stricter rules, so this pull request no longer touches sclangCommand and the two do not collide. The plan's note on the homeRelative item is the only edit here to windows-portability.md.

Testing

From the repository root of this branch, after pnpm install:

pnpm typecheck
pnpm exec vitest run src/commands/export.test.ts src/graph/build.test.ts
FIELD_AUDIOD=$PWD/native/audiod/build/field-audiod_artefacts/Release/field-audiod pnpm test
project check
git diff --stat origin/main

The typecheck passes, the two files pass 64 of 64, and the full suite passes 984 with 1 skipped. project check prints Project plans are valid., and the diff against main touches only src/commands/export.ts, src/commands/export.test.ts, and docs/projects/windows-portability/readme.md. Every case in export.test.ts names its separator, so the test means the same on the Windows CI job as here. With \, C:\Users\justin\Desktop\creek-mix-main-v1.wav comes back as ~\Desktop\creek-mix-main-v1.wav, c:\users\justin\Music as ~\Music, and C:\Users\justinx\Desktop unchanged. With /, /users/justin/Desktop stays as it is under the home /Users/justin. If any comes back otherwise, the change is wrong.

On a Windows machine, field export in a project should now print its destination as ~\Desktop\…. No Windows machine has run it; the unit test is what covers it until one does. Nothing is left behind.

📽️ Projector summary of f9ea793: https://field.amnes.ac/reviews/192

Two of windows-portability.md §7.2's standalone items. homeRelative took / as the separator, so no exported path printed with ~ on Windows; it now takes the platform's. sclangCommand was POSIX-shaped: its PATH search now tries sclang.exe first on Windows, a FIELD_SCLANG with a backslash or a native absolute path is taken as a path rather than a name to look up, and when nothing else finds it the fallback is the newest %ProgramFiles%\SuperCollider-<version>\sclang.exe, where it probes the macOS app bundle only on macOS. The platform is a parameter, so sclang-lookup.test.ts runs the Windows rules here against real files.
Justin's #186 fixes sclangCommand on Windows, opened before this, with its own rules (.com and .exe, never the bare name). This pull request now carries only the homeRelative fix, so the two do not collide.
@ninjudd ninjudd changed the title Print a Windows home path with a tilde, and find sclang on Windows (windows-portability.md §7.2) Print a Windows home path with a tilde (windows-portability.md §7.2) Oct 11, 2026

@ninjudd ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📽️ Projector review · 0.7.4 · model claude-opus-5-5 · effort xhigh · CHANGES REQUESTED · took 23m 35s over 2 heads

This pull request makes field export print a Windows path under the home folder with a tilde, the standalone homeRelative item in windows-portability.md §7.2. homeRelative takes the separator as a parameter that defaults to path.sep, so a Windows export prints as ~\Desktop\…, a sibling such as C:\Users\justinx stays unshortened, and macOS and Linux keep /. The OneDrive-redirected Desktop stays the wart the plan calls it.

This review started on ae05c15, which also ported sclangCommand, the lookup that #186 ports. 6d640ad removed that part and left it to #186, so this review covers only the head below. At this head the two pull requests merge cleanly: they share only the plan file, and they edit different §7.2 items in it.

1 finding thread: 0 resolved, 1 open

Covered 3 of 3 changed files; no generated files.

  • Windows CI. The windows job fails 13 tests at this head. Twelve also fail on main's Windows runs: the 11 known failures in voice-host.test.ts and record-midi-daemon.test.ts, and the plugin-hosting.test.ts inventory-cache test, which fails on some main runs and passes on others. The thirteenth is the thread below. The linux job passes.
  • Windows behavior. This review ran on macOS. It reproduced the Windows default separator by mocking node:path's sep to \. Under the mock, the existing POSIX assertion failed, and a Windows path with the default separator printed as ~\….

Suggestions

  • src/commands/export.ts:74: Windows compares paths without regard to case, so --to c:\users\me\Music prints in full while --to C:\Users\me\Music prints with ~. Comparing case-insensitively when the separator is \ would shorten both. The default Desktop path always matches, because it is built from homedir().

What I ran

  • Install and typecheck. pnpm install --frozen-lockfile and pnpm typecheck pass.
  • Focused tests. pnpm exec vitest run src/commands/export.test.ts src/graph/build.test.ts passes 64 of 64 on macOS.
  • homeRelative. I checked it by reading, by its tests, and under the mocked separator. A Windows path under the home folder prints as ~\…, C:\Users\justinx is not home, and with the default sep POSIX callers get / as before. Its only caller is the export line in src/cli.ts.
  • Plans. project check passes. windows-portability stays in-progress, and this pull request changes no plan status, so it makes no readiness claim.

Comment thread src/commands/export.test.ts Resolved
…indows paths without regard to case

The POSIX assertions left the separator to path.sep, which is a backslash on the Windows CI job, so they failed there; each now passes '/' as the Windows ones pass a backslash. With a backslash separator the home prefix compares case-insensitively, so c:\users\me prints with a tilde like C:\Users\me; only the prefix of the home path's length is compared, so the rest is sliced at the same place.

@ninjudd ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📽️ Projector review · 0.7.4 · model claude-opus-5-5 · effort xhigh · CLEAN · took 14m 46s

This pull request makes field export print a Windows path under the home folder with a tilde, the standalone homeRelative item in windows-portability.md §7.2. homeRelative takes the separator as a parameter that defaults to path.sep, so a Windows export prints as ~\Desktop\…. With \ as the separator, the home prefix compares without regard to case, as Windows paths do. A sibling such as C:\Users\justinx stays unshortened, and macOS and Linux keep / and a case-sensitive comparison. The OneDrive-redirected Desktop stays the wart the plan calls it. The sclang lookup that an earlier head carried is left to #186, and at this head the two pull requests merge cleanly.

1 finding thread: 1 resolved, 0 open

Covered 3 of 3 changed files; no generated files.

  • Windows CI. The windows job was still running its tests when this review was published, so this verdict does not rest on it. The linux job passes. On 6d640ad, the earlier finding was the windows job's only failure beyond main's known ones.
  • Windows behavior. This review ran on macOS. It reproduced a Windows host by mocking node:path's sep to \, and under that mock the whole homeRelative test block passes at this head.

Suggestions

  • Pull request body. The body describes the separator but not the case-insensitive comparison that fa16bea added, and a squash merge makes the body the commit message. Add a sentence on the comparison.
  • docs/projects/windows-portability/readme.md:620: the plan's Done note says the same as the body and could name the case rule too.

What I checked

  • The earlier finding. The thread on src/commands/export.test.ts is fixed at this head. Every POSIX assertion passes '/', and with sep mocked to \ the whole homeRelative block passes. The author had already resolved the thread.
  • The case rule. With the lowercasing removed from homeRelative, only the new c:\users\justin\Music assertion fails, so the test pins it. The POSIX case assertion pins the other side. The prefix is compared and the rest is sliced at the same home.length, so the printed rest is always the path's own characters.
  • Edges. I walked the home folder itself, a path inside it, a sibling that shares its prefix, a shorter path, and a Windows path in another case, with each separator. Each gives the result the tests assert. The only caller, the export line in src/cli.ts, passes the default separator.
  • Install, typecheck, and tests. pnpm install --frozen-lockfile and pnpm typecheck pass, and pnpm exec vitest run src/commands/export.test.ts src/graph/build.test.ts passes 64 of 64 on macOS.
  • Plans. project check passes. windows-portability stays in-progress, and this pull request changes no plan status, so it makes no readiness claim.

@ninjudd
ninjudd marked this pull request as ready for review October 11, 2026 06:34

@ninjudd ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📽️ Projector review · 0.7.4 · model claude-opus-5-5 · effort xhigh · CLEAN · incremental from fa16bea · took 0m 28s

Incremental review of the change since the full review of fa16bea: +4 −2 lines in 1 file.

The change since the full review is prose in the plan's §7.2 Done note for homeRelative, which now names the case rule. I read it against src/commands/export.ts at this head, which is unchanged: with \ the home prefix compares lowercased, so c:\users\me\Music under C:\Users\me prints as ~\Music. The note is accurate, and project check passes. The pull request body names the case rule too, so both suggestions from the full review are taken.

@ninjudd
ninjudd merged commit 8472df5 into main Oct 11, 2026
1 of 2 checks passed
@ninjudd
ninjudd deleted the windows/paths branch October 11, 2026 15:10
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