-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"portable" it's not so portable #1612
Comments
Have you tried using the latest version of electron-builder? |
Just tried now with the latest version of electron-builder. It's doing the same. |
Do you expect that your config will be in the same dir as exe? |
Yes you are correct. Currently if I "copy-paste" the exe folder from one computer to another the software will break since the configuration files will not be available. This will enable to run the software from an USB stick since everything will be "self sufficient / contained" inside the folder where the exe is located. |
electron-builder 19.0.0 will set env |
I think this will work. Thank you. I see that v19.0.0 is currently tagged as "pre-release" - When this version will be tagged as "stable" so that will become available on npm to use. Currently npm shows as the latest version as 18.6.2 https://www.npmjs.com/package/electron-builder Can I load v19.0.0 from npm before it is tagged as "stable"? |
@distributev yes, just |
Any example how to use this |
replace |
"win": { "target": [ "portable" ] }
I am not sure what I am doing wrong. I thought "portable" it's exactly the targeting I need however it does not work as expected.
In development I have an env_development.json with relative folder paths which works great.
{ "name": "development", "folders": { "config": "./playground/config", "logs": "./playground/logs", "temp": "./playground/temp" } }
In "production" (that is the portable .exe file which is generated by nsis) the equivalent env_production.json is
{ "name": "production", "folders": { "config": "./config", "logs": "./logs", "temp": "./temp" } }
In production (when I run the .exe file) the relative paths are not correctly resolved.
Further more, If I log.info (__dirname), I get each time (each different execution) a different randomly generated temp path like
C:\Users\username\AppData\Local\Temp\nsh2EC4.tmp\app\resources\app.asar\app
I think this is happening because of how asar packaging works however the result is that "portable" is not actually portable.
One workaround would be to read the configuration files from the userDataPath location - however I am trying to keep the configuration files next to the generated exe file since this is more easily findable / accessible to the user.
I think "portable" it's not really portable because __dirname it's not reliable and it has a different (random) value each time when I execute the generated .exe file.
What I am doing wrong?
The text was updated successfully, but these errors were encountered: