template/cordova/lib/MSBuildTools.js
function getWillowProgDataPaths () {
    if (!process.env.systemdrive) {
        // running on linux/osx?
        return [];
    }
    var instancesRoot = path.join(process.env.systemdrive, 'ProgramData/Microsoft/VisualStudio/Packages/_Instances');
    if (!shell.test('-d', instancesRoot)) {
        // can't seem to find VS instances dir, return empty result
        return [];
    }

    return fs.readdirSync(instancesRoot).map(function (file) {
        var instanceDir = path.join(instancesRoot, file);
        if (shell.test('-d', instanceDir)) {
            return instanceDir;
        }
    }).filter(function (progDataPath) {
        // make sure state.json exists
        return shell.test('-e', path.join(progDataPath, 'state.json'));
    });
}
function getWillowProgDataPaths () {
    if (!process.env.systemdrive) {
        // running on linux/osx?
        return [];
    }
    var instancesRoot = path.join(process.env.systemdrive, 'ProgramData/Microsoft/VisualStudio/Packages/_Instances');
    if (!shell.test('-d', instancesRoot)) {
        // can't seem to find VS instances dir, return empty result
        return [];
    }

    return fs.readdirSync(instancesRoot).map(function (file) {
        var instanceDir = path.join(instancesRoot, file);
        if (shell.test('-d', instanceDir)) {
            return instanceDir;
        }
    }).filter(function (progDataPath) {
        // make sure state.json exists
        return shell.test('-e', path.join(progDataPath, 'state.json'));
    });
}
function getWillowProgDataPaths ( ) { if ( ! process . env . systemdrive ) { // running on linux/osx? return [ ] ; } var instancesRoot = path . join ( process . env . systemdrive , 'ProgramData/Microsoft/VisualStudio/Packages/_Instances' ) ; if ( ! shell . test ( '-d' , instancesRoot ) ) { // can't seem to find VS instances dir, return empty result return [ ] ; } return fs . readdirSync ( instancesRoot ) . map ( function ( file ) { var instanceDir = path . join ( instancesRoot , file ) ; if ( shell . test ( '-d' , instanceDir ) ) { return instanceDir ; } } ) . filter ( function ( progDataPath ) { // make sure state.json exists return shell . test ( '-e' , path . join ( progDataPath , 'state.json' ) ) ; } ) ; }
Lists all VS 2017+ instances dirs in ProgramData

@return {String[]} List of paths to all VS2017+ instances
Lists all VS 2017 + instances dirs in ProgramData