Open adambrakhane opened 5 years ago
1) My guess is this happens because you provide a relative path. Can you try using something like filepath.Join(a.Paths.DataDirectory(), "resources", "icon-book512.png")
?
2) This is normal that a.Dock()
is nil
in the Adapter
since it's executed just after the calling astilectron.New
and even before disembedding resources. Using OnWait
is a great choice!
No luck. I verified that it was actually giving the correct path out. The icon is correct, but I get the error.
I also found that it was only the bundled app that failed to load correctly. When I run the binary (./output/darwin-amd64/application.app/Contents/MacOS/application) the correct icon appears and there is no JS error. When I open the actual .app file, I get the correct icon, but also the JS alert.
Mmmm this is a really weird one... could you try converting your icon to .icns
and let me know whether you still get the error?
Same story. I referenced the same icns file that I use in AppIconDarwinPath: "resources/icon-book.icns",
and tried with relative & full path.
If it helps, I added some dialogs prints to print out those dock and JSON variables:
if (typeof app.dock !== "undefined") {
dialog.showErrorBox("DOCK", "content")
dialog.showErrorBox("json", JSON.stringify(json))
dialog.showErrorBox("app", JSON.stringify(app))
app.dock.setIcon(json.image);
}
JSON.stringify(json)={"name":"dock.cmd.set.icon","targetID":"dock","image":"/Users/adam/projects/chispa/goapp/src/invenstory/resources/icon-book.icns"}
JSON.stringify(app)={"_events":{},"_eventsCount":10,"commandLine":{},"isPackaged":true,"dock":{}}
Maybe there's something to the fact that dock is empty? Maybe it's just functions and whatnot and wouldn't be printed anyway? Merely commenting out app.dock.setIcon(json.image);
is enough to stop the exception.
Could you try moving the app to the Applications
folder and try again ?
Same thing.
When I set the dock icon on Mac it correctly sets the image but I get a Javascript exception on launch. Other than that, everything seems to run OK. My code is just slightly modified from the demo repo.
The javascript exception is:
On a different note, I tried to use the Astilectron Adapter function in the bootstrap run function and while the a pointer is not nil, a.Dock() is always nil. That's why I moved to trying in OnWait.
Adapter: func(a *astilectron.Astilectron) {a.Dock() == nil // True},