Make Windows batch entrypoints location-relative#31
Merged
Conversation
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.
Non-technical summary
This fixes the Windows command entrypoints so the build, test, and publish scripts work when they are launched from outside the repository root.
This matters now because the repo has already moved its hooks and Unix scripts toward location-relative behavior, but the main Windows batch entrypoints still depended on the caller's current directory. That made routine contributor workflows fragile for no product benefit.
After this change, the Windows batch workflow is more predictable:
compile.bat,test.bat, andpublish.batnow anchor themselves to the repo checkout instead of the shell location they were launched from.Technical summary
compile.batto deriveROOTDIRfrom%~dp0, switch drives withcd /d, and call thescripts/helpers via absolute repo-root paths.test.batto deriveROOTDIRfrom%~dp0and usecd /dfor the test loop and repo-root return path.publish.batto callcompile.batthrough an absolute repo-root path and usecd /dwhen returning to the checkout root../test.shon macOS after the change; the existing macOS compile-only test flow still passes.cmd.exeexecution was not available on this host, so Windows proof for the batch behavior is static review of the changed control flow rather than local runtime execution.Additional notes
Trade-off: I kept the scope strictly to path resolution and drive-safe directory changes instead of broadening into batch-script cleanup.
Deferred follow-up: the helper batch scripts under
scripts/could be given the same caller-independent treatment in a separate pass if we want every Windows helper to follow the same contract.Remaining gap: this closes the top-level entrypoint fragility, but hosted or native Windows execution is still the stronger proof surface for the batch behavior itself.