asticode / go-astilectron-bundler

Bundle your Astilectron app with ease
MIT License
129 stars 68 forks source link

Mac OSX .app can not start second time. #83

Closed bogdanfinn closed 4 years ago

bogdanfinn commented 4 years ago

Finally i managed to get my astilectron app running on a Mac. I do not use go-astilectron-bootstrap as discussed and mentioned here: https://github.com/asticode/go-astilectron-bundler/issues/82

Now i have the following issue and i think this is something related to caching issues. But i'm not 100% sure. I'm creating a bundle and move the generated Mac OS .app File to my /Applications/ Directory.

When i'm starting the App the first time everything works fine. resources and vendor directories are restored under /Applications/MyApp.app/Contents/MacOS

Now i'm closing my application and want to restart it. The app icon blinks a second in the Dock and then disappears. Nothing more happens. When i go into the /Applications/MyApp.app/Contents/MacOS directory and run the application binary via Terminal by hand i get from the logs the following interesting part:

Astilectron has already been provisioned to version 0.41.0, moving on...
Electron has already been provisioned to version 7.1.10, moving on...
Listening...
Executing...
Starting cmd /Applications/MyApp.app/Contents/MacOS/vendor/electron-darwin-amd64/My App.app/Contents/MacOS/My App /Applications/MyApp.app/Contents/MacOS/vendor/astilectron/main.js 127.0.0.1:59333 false
Closing...
astikit: stopping worker...
accept tcp 127.0.0.1:59333: use of closed network connection while TCP accepting
Stopping...

The interesting part here is that the Name of my App is Wrong. In the path the name is My App with a space. But actually my app name is MyApp without a space.

The correct command should be:

Starting cmd /Applications/MyApp.app/Contents/MacOS/vendor/electron-darwin-amd64/MyApp.app/Contents/MacOS/MyApp /Applications/MyApp.app/Contents/MacOS/vendor/astilectron/main.js 127.0.0.1:59333 false

Or am i wrong?

As i said i think it is related to cache issues because the app name My App with a space was the previous name i changed to MyApp without a space. I already tried to clear the cache but this did not help.

Is it possible that somewhere the old electron / astilectron files are provisioned with my old App Name which i have to delete first?

asticode commented 4 years ago

My only guess is that your binary didn't get updated and your app name is still My App in it. It should be easy to check : just log the app name you're providing astilectron in your GO binary and see whether there's a space in it.

bogdanfinn commented 4 years ago

@asticode Nevermind. It was totally my fault. My issue was that i implemented before in my app (when the app had the "old" name with the space) an update functionality where the app downloads and replaces the binary with a potential update from a server.

To my disadvantage the update which still is on that server for testing purpose was compiled with the old app name (the space). Now it makes sense that the issue only appears on the second start..

I am sorry to bother you with sometimes very dumb issues which are my fault...but sometimes you just need someone you can tell your problems to ..