File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments