diff --git a/src/autoStart/win32.js b/src/autoStart/win32.js index 511a892..085be10 100644 --- a/src/autoStart/win32.js +++ b/src/autoStart/win32.js @@ -1,6 +1,6 @@ const { join, basename } = require('path'); -const reg = require('../utils/registry'); +const reg = (a, c) => require('child_process').execFile('reg.exe', a, c); const appName = basename(process.execPath, '.exe'); const queuePrefix = [ 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run', '/v', appName ]; diff --git a/src/utils/registry.js b/src/utils/registry.js deleted file mode 100644 index 7088a9d..0000000 --- a/src/utils/registry.js +++ /dev/null @@ -1,3 +0,0 @@ -const CP = require('child_process'); - -module.exports = (args, cb) => CP.execFile('reg.exe', args, cb); \ No newline at end of file diff --git a/src/winFirst.js b/src/winFirst.js index e8c4852..62e0331 100644 --- a/src/winFirst.js +++ b/src/winFirst.js @@ -1,6 +1,8 @@ const fs = require('fs'); const { join, resolve, basename } = require('path'); +const reg = (a, c) => require('child_process').execFile('reg.exe', a, c); + const Constants = require('./Constants'); const reg = require('./utils/registry'); @@ -17,7 +19,8 @@ exports.do = (updater) => { const base = 'HKCU\\Software\\Classes\\' + proto; for (const x of [ - [base, '/ve', '/d', `URL:${proto} Protocol`], [base, '/v', 'URL Protocol'], + [base, '/ve', '/d', `URL:${proto} Protocol`], + [base, '/v', 'URL Protocol'], [base + '\\DefaultIcon', '/ve', '/d', `"${exec}",-1`], [base + '\\shell\\open\\command', '/ve', '/d', `"${exec}" --url -- "%1"`] ]) reg([ 'add', ...x, '/f' ], e => {});