pulsar/script/lib/delete-msbuild-from-path.js

23 lines
512 B
JavaScript
Raw Normal View History

2019-05-31 19:33:56 +03:00
'use strict';
2019-05-31 19:33:56 +03:00
const fs = require('fs');
const path = require('path');
2019-05-31 19:33:56 +03:00
module.exports = function() {
process.env['PATH'] = process.env['PATH']
.split(';')
.filter(function(p) {
if (fs.existsSync(path.join(p, 'msbuild.exe'))) {
console.log(
'Excluding "' +
p +
'" from PATH to avoid msbuild.exe mismatch that causes errors during module installation'
);
return false;
} else {
return true;
}
})
.join(';');
};