Skip to content

Commit

Permalink
Patch Windows SDK bin path in a more reliable way.
Browse files Browse the repository at this point in the history
Signed-off-by: Yonggang Luo <[email protected]>
  • Loading branch information
lygstate committed Sep 27, 2021
1 parent ab01f50 commit 567fdb6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -736,14 +736,17 @@ async function collectDevBatVars(hostArch: string, devbat: string, args: string[
}
if (util.compareVersion(WindowsSDKVersionParsed, {major: 10, minor: 0, patch: 14393}) >= 0) {
const WindowsSdkDir = vars.get('WindowsSdkDir') ?? '';
const existPath = vars.get('PATH') ?? '';
const pathKey = vars.has('Path') ? 'Path' : 'PATH';
const existPath = vars.get(pathKey) ?? '';
const oldWinSdkBinPath = path.join(WindowsSdkDir, 'bin', hostArch);
const newWinSdkBinPath = path.join(WindowsSdkDir, 'bin', WindowsSDKVersion, hostArch);
if (existPath.toLowerCase().indexOf(oldWinSdkBinPath.toLowerCase()) >= 0
&& existPath.toLowerCase().indexOf(newWinSdkBinPath.toLowerCase()) < 0) {
const newWinSdkBinPathExist = await fs.exists(newWinSdkBinPath);
if (newWinSdkBinPathExist &&
existPath !== '' &&
existPath.toLowerCase().indexOf(newWinSdkBinPath.toLowerCase()) < 0) {
log.info(localize('windows.sdk.path.patch', 'Patch Windows SDK bin path from {0} to {1} for {2}',
oldWinSdkBinPath, newWinSdkBinPath, devbat));
vars.set('PATH', `${newWinSdkBinPath};${existPath}`);
vars.set(pathKey, `${newWinSdkBinPath};${existPath}`);
}
}
log.debug(localize('ok.running', 'OK running {0} {1}, env vars: {2}', devbat, args.join(' '), JSON.stringify([...vars])));
Expand Down

0 comments on commit 567fdb6

Please sign in to comment.