Resolve relative launch.json workingDirectory against the workspace folder - #116
Merged
Chiara Mooney (chiaramooney) merged 1 commit intoAug 3, 2026
Conversation
Collaborator
|
Ran our PR Review agent on this PR. Just a couple small fixes. Please address and resolve merge conflicts and then we can merge your changes in! |
…older The debug adapter passed config.workingDirectory straight to spawn, so a relative value resolved against the extension host's process.cwd() instead of the workspace folder. Windows drive-relative forms like C:out resolved against the current directory of the drive. Adds resolveWorkingDirectory() in winapp-cli-utils.ts and uses it for the winapp run spawn cwd, with unit tests covering unset, relative, parent, absolute, and drive-relative values.
Sanjay Santhanam (Sanjays2402)
force-pushed
the
fix/112-relative-working-directory
branch
from
August 2, 2026 06:53
81159be to
4afeb7e
Compare
Chiara Mooney (chiaramooney)
approved these changes
Aug 3, 2026
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.
Description
Fixes the relative
workingDirectoryresolution described in #112.WinAppDebugAdapterFactory.createDebugAdapterDescriptorpassedconfig.workingDirectorystraight through as thespawncwd:A relative value from launch.json therefore resolved against the extension host's
process.cwd()rather than the workspace folder, sowinapp runstarted from an unrelated directory. On Windows the drive-relative form (C:out) has the same problem, resolving against the current directory of driveC:instead of the workspace.This adds
resolveWorkingDirectory()tosrc/winapp-cli-utils.tsand uses it for the spawn cwd. Absolute paths pass through unchanged, unset values keep falling back to the workspace folder, and everything else is resolved againstfolder.uri.fsPath.path.resolvealso covers the drive-relative case.The helper lives in
winapp-cli-utils.tsrather than inline inextension.tsso it can be unit tested without the extension host, matching howproject-resolver.tsand the other extracted helpers are tested here.Usage Example
{ "type": "winapp", "request": "launch", "name": "WinApp: Launch and Attach", "workingDirectory": "./subdir" }./subdirnow resolves against the workspace folder instead of the extension host's cwd.Related Issue
Fixes #112
Type of Change
Checklist
Additional Notes
New unit tests in
src/test/working-directory.test.tscover unset, empty, relative, dot-prefixed, parent-relative, absolute, and (on Windows) drive-relative values, plus an explicit assertion that resolution does not fall back toprocess.cwd(). The file is registered in thetest:unitscript.npm run test:unitgoes from 715 to 722 tests, passing 701 to 708. The 14 failures are pre-existing on this machine and unrelated to this change: they are Windows-only suites (resolveWindowsPowerShellPath,isUsableElevatedCliPath,isArtifactWithinRoot,buildPackSuccessMessage) that fail identically on an unmodifiedmaincheckout, since I developed this on macOS.npx tsc -p ./andnpx eslint srcare both clean (8 pre-existing warnings, 0 errors).I could not run
.\scripts\build-vsce.ps1or the e2e suite, since both need Windows.