Skip to content

Commit 43e8180

Browse files
committed
Revert "Fix ps1 path casing on case-insensitive filesystems (Windows)"
This reverts commit 5ba482e.
1 parent 5ba482e commit 43e8180

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

src/managers/common/utils.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,11 @@ export async function getShellActivationCommands(binDir: string): Promise<{
183183
shellActivation.set(ShellConstants.KSH, [{ executable: '.', args: [path.join(binDir, `activate`)] }]);
184184
shellDeactivation.set(ShellConstants.KSH, [{ executable: 'deactivate' }]);
185185

186-
// Use readdir to find the actual ps1 filename with correct casing.
187-
// pathExists with a hardcoded name fails on case-insensitive filesystems (Windows)
188-
// where 'activate.ps1' created by the user would match 'Activate.ps1' in the check,
189-
// causing the returned path to have the wrong case.
190-
const dirFiles = await fs.readdir(binDir).catch(() => [] as string[]);
191-
const ps1File = dirFiles.find((f) => f.toLowerCase() === 'activate.ps1');
192-
if (ps1File) {
193-
shellActivation.set(ShellConstants.PWSH, buildPwshActivationCommands(path.join(binDir, ps1File)));
186+
if (await fs.pathExists(path.join(binDir, 'Activate.ps1'))) {
187+
shellActivation.set(ShellConstants.PWSH, buildPwshActivationCommands(path.join(binDir, 'Activate.ps1')));
188+
shellDeactivation.set(ShellConstants.PWSH, [{ executable: 'deactivate' }]);
189+
} else if (await fs.pathExists(path.join(binDir, 'activate.ps1'))) {
190+
shellActivation.set(ShellConstants.PWSH, buildPwshActivationCommands(path.join(binDir, 'activate.ps1')));
194191
shellDeactivation.set(ShellConstants.PWSH, [{ executable: 'deactivate' }]);
195192
}
196193

0 commit comments

Comments
 (0)