Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Bug on macOS while restoring assets on first launch #14

Closed
aeddi opened this issue Mar 20, 2019 · 3 comments
Closed

Bug on macOS while restoring assets on first launch #14

aeddi opened this issue Mar 20, 2019 · 3 comments

Comments

@aeddi
Copy link

aeddi commented Mar 20, 2019

Hello,

When I build my Electron App using astilectron-bootstrap and astilectron-bundler, I can open it normally with the computer I used to build it (double-click on myapp.app from the finder or using this command open myapp.app) but I can't from another computer.

After a little investigation, I realized that the problem occurred when the restoreResources function was called.

I got this error when it tries to remove resources:

removing /private/var/folders/yt/h63bwpcs5_3dwlv_8_mxgphw0000gn/T/AppTranslocat
ion/F1665C30-7AB9-4745-82BC-E8E06910032D/d/Berty.app/Contents/MacOS/resources f
ailed: read-only file system

Then the app crash.

If I manually launch the binary contained in the package ./myapp.app/Contents/MacOS/myapp, it works. The files are well decompressed in .myapp.app/Contents/MacOS/resource (not /private/var/...) then I can launch the application normally from the finder.

Signing the application with a production certificate doesn't solve the problem.

If you have an idea to solve the problem, I'll take it. :)
I will continue to investigate and submit a PR to you if I find a solution.


macOS version: Mojave 10.14.3
astilectron-bootstrap version: latest (commit b321164)
astilectron-bundler version: latest (commit 6b22eaf)

@aeddi
Copy link
Author

aeddi commented Mar 20, 2019

Ok, actually, the problem comes from the fact that when you launch the application from the finder or the open command, a call to the os.Executable() function returns the wrong path, it returns the "AppTranslocation" path instead of the real binary path.
So the initBaseDirectory doesn't work correctly in this case (and I don't know if that can be a problem elsewhere in the code).

I have just seen by inquiring that since macOS 10.12, Gatekeeper Path Randomization has become mandatory for application distributed outside the Store and from what I see, the problem doesn't appear on the machine that was used to build the application.

Well, I'm starting to look for a solution again.

@aeddi
Copy link
Author

aeddi commented Mar 21, 2019

Apparently the best way to get around the path randomization is to force the user to put the .app in the Applications folder.

So problem solved.

@aeddi aeddi closed this as completed Mar 21, 2019
@asticode
Copy link
Owner

Good to know, thanks for sharing!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants