mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-18 17:23:16 +00:00
fix \x27split\x27 #254
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -978,24 +978,17 @@ function getCurrent()
|
|||||||
{
|
{
|
||||||
if(process.platform == 'win32')
|
if(process.platform == 'win32')
|
||||||
{
|
{
|
||||||
// On windows wi will use WMI via WMIC to get the LCID.
|
// On windows we will use WMI to get the LCID.
|
||||||
var child = require('child_process').execFile(process.env['windir'] + '\\system32\\wbem\\wmic.exe', ['wmic', 'os', 'get', 'oslanguage','/FORMAT:LIST']);
|
if (process.platform == 'win32') {
|
||||||
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
var tokens = require('win-wmi').query('ROOT\\CIMV2', 'SELECT OSLanguage FROM Win32_OperatingSystem', ['OSLanguage']);
|
||||||
child.stderr.str = ''; child.stderr.on('data', function (c) { this.str += c.toString(); });
|
if (tokens[0]) {
|
||||||
child.waitExit();
|
|
||||||
|
|
||||||
var lines = child.stdout.str.trim().split('\r\n');
|
|
||||||
var tokens;
|
|
||||||
for (var i in lines)
|
|
||||||
{
|
|
||||||
tokens = lines[i].split('=');
|
|
||||||
if(tokens[0]=='OSLanguage')
|
|
||||||
{
|
|
||||||
// Convert LCID to language string
|
// Convert LCID to language string
|
||||||
return (toLang(tokens[1]));
|
return (toLang(tokens[0]['OSLanguage'].toString()));
|
||||||
|
} else {
|
||||||
|
// fallback to en-us to avoid crashing
|
||||||
|
return ("en-us");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(process.env['LANG'])
|
if(process.env['LANG'])
|
||||||
|
|||||||
Reference in New Issue
Block a user