Wednesday 7 June 2017

Built Electron App path

I have an electron app, that also operates on files in the same directory. These are not files the user selects, or files bundled inside the electron application, but I do need to reference them

For example, my electron app may need to unzip and extract a zip file in the same directory if it exists. But how do you reliably acquire this path?

Specifically, I want the .app bundles folder on Mac OS, or the .exe on Windows, not the JS file.

app.getAppPath() returns /Users/.. ../test.app/Contents/Resources/app which isn't useful, and running electron on the source directly rather than packaging it gives a different folder path, it's very inconsistent. Electron itself returns / for the current working directory



via Tom J Nowell

No comments:

Post a Comment