diff --git a/index.js b/index.js index f8025ae..10b1e48 100644 --- a/index.js +++ b/index.js @@ -5,9 +5,11 @@ const path = require('path') const process = require('process') const PROGRAM_FILES_X86 = process.env['ProgramFiles(x86)'] +const PROGRAM_FILES = [process.env['ProgramFiles(x86)'], process.env['ProgramFiles']] + const EDITIONS = ['Enterprise', 'Professional', 'Community'] -const VERSIONS = ['2019', '2017'] +const VERSIONS = ['2022', '2019', '2017'] const VSWHERE_PATH = `${PROGRAM_FILES_X86}\\Microsoft Visual Studio\\Installer` @@ -32,13 +34,15 @@ function findVcvarsall() { // If that does not work, try the standard installation locations, // starting with the latest and moving to the oldest. - for (const ver of VERSIONS) { - for (const ed of EDITIONS) { - path = `${PROGRAM_FILES_X86}\\Microsoft Visual Studio\\${ver}\\${ed}\\VC\\Auxiliary\\Build\\vcvarsall.bat` - core.info(`Trying standard location: ${path}`) - if (fs.existsSync(path)) { - core.info(`Found standard location: ${path}`) - return path + for (const prog_files of PROGRAM_FILES) { + for (const ver of VERSIONS) { + for (const ed of EDITIONS) { + path = `${prog_files}\\Microsoft Visual Studio\\${ver}\\${ed}\\VC\\Auxiliary\\Build\\vcvarsall.bat` + core.info(`Trying standard location: ${path}`) + if (fs.existsSync(path)) { + core.info(`Found standard location: ${path}`) + return path + } } } }