mirror of
https://github.com/Eugeny/tabby.git
synced 2025-04-12 16:10:26 +08:00
Fix the problem that the Developer Prompt for VS 2022
profile could not be loaded
This commit is contained in:
parent
fa2bbe39c4
commit
7cddcee951
@ -27,30 +27,32 @@ export class VSDevToolsProvider extends ShellProvider {
|
||||
return []
|
||||
}
|
||||
|
||||
const parentPath = path.join(process.env['programfiles(x86)'] ?? 'C:\\Program Files (x86', 'Microsoft Visual Studio')
|
||||
|
||||
try {
|
||||
await fs.stat(parentPath)
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
const x86ParentPath = path.join(process.env['programfiles(x86)'] ?? 'C:\\Program Files (x86)', 'Microsoft Visual Studio')
|
||||
const x64ParentPath = path.join(process.env['programfiles'] ?? 'C:\\Program Files', 'Microsoft Visual Studio')
|
||||
|
||||
const result: Shell[] = []
|
||||
for (const version of await fs.readdir(parentPath)) {
|
||||
const bat = path.join(parentPath, version, 'Community\\Common7\\Tools\\VsDevCmd.bat')
|
||||
for (const parentPath of [x86ParentPath, x64ParentPath]) {
|
||||
try {
|
||||
await fs.stat(bat)
|
||||
} catch {
|
||||
continue
|
||||
await fs.stat(parentPath)
|
||||
for (const version of await fs.readdir(parentPath)) {
|
||||
const bat = path.join(parentPath, version, 'Community\\Common7\\Tools\\VsDevCmd.bat')
|
||||
try {
|
||||
await fs.stat(bat)
|
||||
} catch {
|
||||
continue
|
||||
}
|
||||
result.push({
|
||||
id: `vs-cmd-${version}`,
|
||||
name: `Developer Prompt for VS ${version}`,
|
||||
command: 'cmd.exe',
|
||||
args: ['/k', bat],
|
||||
icon: vsIconMap[version],
|
||||
env: {},
|
||||
})
|
||||
}
|
||||
} catch (_) {
|
||||
// Ignore
|
||||
}
|
||||
result.push({
|
||||
id: `vs-cmd-${version}`,
|
||||
name: `Developer Prompt for VS ${version}`,
|
||||
command: 'cmd.exe',
|
||||
args: ['/k', bat],
|
||||
icon: vsIconMap[version],
|
||||
env: {},
|
||||
})
|
||||
}
|
||||
return result
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user