kessler / node-regedit

Read, Write, List and do all sorts of funky stuff to the windows registry using node.js and windows script host
MIT License
279 stars 45 forks source link

Docs: Explain how to use in Electron #56

Closed afroewis closed 6 years ago

afroewis commented 6 years ago

When I used this package, it worked when running my electron app during development, but not in the packaged application. By searching this repo's issues, I found https://github.com/ironSource/node-regedit/issues/46.

As the README doesn't say anything about setExternalVBSLocation, I think it would be useful to save pain for new users that want to use this package in their Electron app. As there are currently no docs, maybe it would be enough to explain this in README.md.

Taxel commented 6 years ago

@muminasaad could you provide a pull request with exact details how to use it? I am getting "Folder not found" when using the method, even though I copied the vbs folder to ./assets/ and am calling regedit.setExternalVBSLocation("./assets/vbs/")

afroewis commented 6 years ago

@Taxel I'm not sure using a relative path will work in most cases. Probably it's safer to use an absolute path? At least when running a packaged electron app.

This is how I do it in my electron app:

const vbsDirectory = path.join(path.dirname(electron.remote.app.getPath('exe')), './resources/foo');
regedit.setExternalVBSLocation(vbsDirectory);

Note that I move the node-regedit assets to the resources/foo folder using electron-builder when building my application.

kessler commented 6 years ago

@afroewis merged, thank you for the PR