1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-17 08:43:21 +00:00

Worked around wmic formatting bug in Windows 7 / Server 2008

This commit is contained in:
Bryan Roe
2020-12-09 13:10:23 -08:00
parent d5b5efe2eb
commit c8500a4ee5
3 changed files with 47 additions and 9 deletions

View File

@@ -1036,3 +1036,38 @@ Object.defineProperty(obj, 'current', {
}
});
module.exports = obj;
if (process.platform == 'win32')
{
Object.defineProperty(module.exports, 'wmicXslPath',
{
get: function ()
{
if (this._wmicpath == null)
{
var tmp = process.env['windir'] + '\\system32\\wbem\\' + this.current + '\\';
if (require('fs').existsSync(tmp + 'csv.xsl'))
{
this._wmicpath = tmp;
}
}
if(this._wmicpath == null)
{
var f = require('fs').readdirSync(process.env['windir'] + '\\system32\\wbem');
for(var i in f)
{
var path = process.env['windir'] + '\\system32\\wbem\\' + f[i];
if(require('fs').statSync(path).isDirectory())
{
if (require('fs').existsSync(path + '\\csv.xsl'))
{
this._wmicpath = path + '\\';
break;
}
}
}
}
return (this._wmicpath);
}
});
}