Commit 3df9d97
* fix: always prepend separator when appending noConfigScripts to PATH
EnvironmentVariableCollection.append() performs a literal string concatenation
and does not insert a path separator. The previous heuristic checked
process.env.PATH on the extension host and skipped the separator when that PATH
already ended with one. However, the PATH used by the integrated terminal can
differ from the extension host's PATH, so this check could incorrectly drop the
separator and glue the noConfigScripts directory onto the last entry of the
user's PATH (e.g. C:\Program Files\jreleaser\c:\Users\...\noConfigScripts).
Always prepend the separator. A trailing empty PATH entry (if the user's PATH
already ended with one) is harmless on both Windows and POSIX shells.
Fixes #1637
* test: add unit tests for noConfigScripts PATH append helper
Extract the PATH append-value computation into a vscode-free
src/pathUtil.ts module so it can be unit-tested in plain Node mocha.
Add test/pathUtil.test.ts covering:
- Correct separator on Windows (;), Linux (:), and macOS (:).
- The appended value always starts with a path separator (regression
guard for #1637).
- The scripts directory remains a standalone PATH entry when the user's
PATH last entry has no trailing separator (the exact scenario reported
in #1637, e.g. C:\Program Files\jreleaser\\).
- A trailing separator on the user's PATH only produces a harmless empty
entry, never glues another entry onto our scripts dir.
- The scripts directory is preserved verbatim at the end of the value.
All 9 tests pass under plain mocha; the file is also picked up by the
existing Electron-based test runner via the **/**.test.js glob.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* style: trim verbose comments in pathUtil and tests
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0db5f15 commit 3df9d97
3 files changed
Lines changed: 86 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 95 | + | |
102 | 96 | | |
103 | 97 | | |
104 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
0 commit comments