用户桌面路径有空格的导致创建不了的问题

This commit is contained in:
2023-03-31 10:50:01 +08:00
parent 4d104bca63
commit 374204a0bb
3 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "JUSTAR", "name": "JUSTAR",
"version": "2.2.2", "version": "2.2.3",
"description": "钜星科技便民问诊系统", "description": "钜星科技便民问诊系统",
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {

View File

@ -159,7 +159,7 @@ let main ={
} }
}, },
{ {
label:'版本号:2.2.2', label:'版本号:2.2.3',
icon: respath + path.sep+ "static"+ path.sep+"images"+ path.sep+"paste.png", icon: respath + path.sep+ "static"+ path.sep+"images"+ path.sep+"paste.png",
},] },]
}); });

View File

@ -108,8 +108,9 @@
if (error != null) { if (error != null) {
console.log('获取注册表桌面路径失败,异常如下:' + error); console.log('获取注册表桌面路径失败,异常如下:' + error);
} else { } else {
let value = iconv.decode(new Buffer(stdout, binaryEncoding), encoding).split(" "); let value = iconv.decode(new Buffer(stdout, binaryEncoding), encoding);
desktop = value[value.length - 1].replace(/^\s*|\s*$/g, ""); //获取注册表实际值并去除首尾空格 value = value.substring(value.indexOf(":") - 1);
desktop = value.replace(/^\s*|\s*$/g, ""); //获取注册表实际值并去除首尾空格
} }
}); });
if (!desktop) { if (!desktop) {