From f3fc8b548eebb2c45898d9cd97f8c557b67944a2 Mon Sep 17 00:00:00 2001 From: myllxy <2720190431@qq.com> Date: Tue, 18 Oct 2022 09:47:55 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E5=88=86=E7=94=A8=E6=88=B7=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=A1=8C=E9=9D=A2=E6=8C=87=E5=90=91=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=BF=AB=E6=8D=B7=E6=96=B9=E5=BC=8F=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=90=8E=E6=89=BE=E4=B8=8D=E5=88=B0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98,=20=E7=8E=B0=E6=94=B9=E4=B8=BA=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E8=A1=A8=E4=B8=AD=E5=AE=9E=E9=99=85=E6=A1=8C?= =?UTF-8?q?=E9=9D=A2=E6=8C=87=E5=90=91=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/setting.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/views/setting.html b/src/views/setting.html index 00cd2fb..3c80093 100644 --- a/src/views/setting.html +++ b/src/views/setting.html @@ -94,11 +94,24 @@ const fs = require("fs"); const ws = require('windows-shortcuts'); const os=require('os'); - let desktop = dpth.join(os.homedir(), 'Desktop'); + const process = require('child_process'); + const keyPath = 'HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders';//选择要修改或者保存或者删除的路径(操作路径) + let desktop; let ele = require('electron'); let ipcRenderer = ele.ipcRenderer; window.$ = window.jquery = require('jquery'); let update_info = {}; + process.exec(`REG QUERY "${keyPath}" /v Desktop`, function (error, stdout, stderr) { + if (error != null) { + console.log('获取注册表桌面路径失败,异常如下:' + error); + } else { + let value = stdout.split(" "); + desktop = value[value.length - 1].replace(/^\s*|\s*$/g, ""); //获取注册表实际值并去除首尾空格 + } + }); + if (!desktop) { + desktop = dpth.join(os.homedir(), 'Desktop'); + } log.info("-->进入配置页面..."); //进行程序检查更新