Skip to content

Commit dd9e811

Browse files
Strum355claude
andcommitted
fix: add normalizePath to traverseForWrapper for Windows compatibility
traverseForWrapper was extracted from base_java.js but the normalizePath call (lowercases paths on Windows for case-insensitive comparison) was left behind. Move normalizePath into tools.js and call it inside traverseForWrapper so all callers get normalization automatically. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c208ccf commit dd9e811

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/providers/base_java.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ export default class Base_Java {
144144

145145
const useWrapper = getWrapperPreference(this.globalBinary, opts)
146146
if (useWrapper) {
147-
const manifestDir = path.dirname(this.normalizePath(manifestPath))
148147
const wrapper = traverseForWrapper(manifestDir, this.localWrapper)
149148
if (wrapper !== undefined) {
150149
try {
@@ -168,8 +167,4 @@ export default class Base_Java {
168167
return toolPath
169168
}
170169

171-
normalizePath(thePath) {
172-
const normalized = path.resolve(thePath).normalize();
173-
return process.platform === 'win32' ? normalized.toLowerCase() : normalized;
174-
}
175170
}

src/tools.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@ export function getGitRootDir(cwd) {
139139
}
140140
}
141141

142+
/**
143+
* Normalize a filesystem path, lowercasing on Windows for case-insensitive comparison.
144+
*
145+
* @param {string} thePath
146+
* @returns {string}
147+
*/
148+
export function normalizePath(thePath) {
149+
const normalized = path.resolve(thePath).normalize()
150+
return process.platform === 'win32' ? normalized.toLowerCase() : normalized
151+
}
152+
142153
/**
143154
* Walk up from `startDir` to `repoRoot` looking for an executable wrapper script.
144155
*
@@ -148,7 +159,7 @@ export function getGitRootDir(cwd) {
148159
* @returns {string | undefined}
149160
*/
150161
export function traverseForWrapper(startDir, wrapperName, repoRoot = undefined) {
151-
const currentDir = path.resolve(startDir)
162+
const currentDir = normalizePath(startDir)
152163
repoRoot = repoRoot || getGitRootDir(currentDir) || path.parse(currentDir).root
153164
const wrapperPath = path.join(currentDir, wrapperName)
154165
try {

0 commit comments

Comments
 (0)