The path environment variable is Path under windows, so read it in a case insensitive manner

This commit is contained in:
Alex Dima 2022-02-16 18:02:09 +01:00
parent 887415bba1
commit e420869a96
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9

View file

@ -54,7 +54,7 @@ export async function buildUserEnvironment(startParamsEnv: { [key: string]: stri
const binFolder = environmentService.isBuilt ? join(environmentService.appRoot, 'bin') : join(environmentService.appRoot, 'resources', 'server', 'bin-dev');
const remoteCliBinFolder = join(binFolder, 'remote-cli'); // contains the `code` command that can talk to the remote server
let PATH = env.PATH;
let PATH = readCaseInsensitive(env, 'PATH');
if (PATH) {
PATH = remoteCliBinFolder + delimiter + PATH;
} else {
@ -255,6 +255,12 @@ export class ExtensionHostConnection {
}
}
function readCaseInsensitive(env: { [key: string]: string | undefined }, key: string): string | undefined {
const pathKeys = Object.keys(env).filter(k => k.toLowerCase() === key.toLowerCase());
const pathKey = pathKeys.length > 0 ? pathKeys[0] : key;
return env[pathKey];
}
function setCaseInsensitive(env: { [key: string]: unknown }, key: string, value: string): void {
const pathKeys = Object.keys(env).filter(k => k.toLowerCase() === key.toLowerCase());
const pathKey = pathKeys.length > 0 ? pathKeys[0] : key;