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:
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user