Potentially improve path detection of regedit vbs files (#1288)

This commit is contained in:
Oscar Hinton 2022-02-03 19:39:23 +01:00 committed by GitHub
parent 94b561382d
commit 166c459da4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -244,9 +244,15 @@ export class NativeMessagingMain {
return this.exePath;
}
private async createWindowsRegistry(check: string, location: string, jsonFile: string) {
private getRegeditInstance() {
const regedit = require("regedit");
regedit.setExternalVBSLocation("resources/regedit/vbs");
regedit.setExternalVBSLocation(path.join(path.dirname(this.exePath), "resources/regedit/vbs"));
return regedit;
}
private async createWindowsRegistry(check: string, location: string, jsonFile: string) {
const regedit = this.getRegeditInstance();
const list = util.promisify(regedit.list);
const createKey = util.promisify(regedit.createKey);
@ -281,7 +287,7 @@ export class NativeMessagingMain {
}
private async deleteWindowsRegistry(key: string) {
const regedit = require("regedit");
const regedit = this.getRegeditInstance();
const list = util.promisify(regedit.list);
const deleteKey = util.promisify(regedit.deleteKey);