Skip to content
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

App crashes when using appdmg built with node 14 #193

Open
Blatman opened this issue Oct 11, 2020 · 1 comment
Open

App crashes when using appdmg built with node 14 #193

Blatman opened this issue Oct 11, 2020 · 1 comment

Comments

@Blatman
Copy link

Blatman commented Oct 11, 2020

MacOS High Sierra 10.13.6

NW.js 0.41.3 (node 12.12.0) works OK with appdmg installed with 12.18.0
NW.js 0.48.3 (node 14.11.0) FAILS with appdmg installed with 14.9.0

App crashes in the 'Making all the visuals' step. If the ds.write is skipped then appdmg will successfully create a DMG but with no visuals.

The code that is causing the issue is the ds.setBackgroundPath line - if this is commented out then again a good DMG will be created but with no background visuals.
The other bits of the visuals steps appear OK.

A console.log prior to this line shows the same format whether appdmg is using node 12 or 14 but only fails with 14 install.

appdmg.js L371 ds.setBackgroundPath(path.join(global.temporaryMountPath, global.bkgname))
gives eg: /Volumes/PepperFlash Install 18/.background/dmgback.tiff

Seems like appdmg installed with node 14 doesn't like tiff being written to the ds-store module.

The original image being used for the background was dmgback.png (82k) which obviously gets converted to a tiff.

appdmg.json -

{
"title": "PepperFlash Install",
"background": "Extras/dmg/dmgback.png",
"icon": "Extras/dmg/dmg.icns",
"contents": [
{
"x": 260,
"y": 350,
"type": "link",
"path": "/Applications"
},
{
"x": 90,
"y": 350,
"type": "file",
"path": "application.app"
},
{
"x": 490,
"y": 350,
"type": "file",
"path": "Extras/dmg/readme.txt"
},
{
"x": 512,
"y": 900,
"type": "position",
"path": ".VolumeIcon.icns"
}
]
}

@Blatman
Copy link
Author

Blatman commented Oct 12, 2020

Update:

drilled down a bit further and it appears the culprit is the mac-alias module.

The point of failure is at line 66 info.volume = { .....
If this line is commented out and the name is set to what is normally expected the DMG is created OK with all visuals intact.
I'm guessing that the volume.node binary is a specific node version so a node 12 build works but node 14 fails.

Typical Volume path is /Volumes/PepperFlash Install 2

create.js -
L66 info.volume = {
// name: addon.getVolumeName(volumePath), // equates to ../build/Release/volume.node.getVolumeName('/Volumes/PepperFlash Install 2')
name: "PepperFlash Install",

The graphic below shows the result of the hardcoded patch where the DMG will create OK - without the hardcode the app will crash.

OK with name hardcoded

Ugly Hack - needed to get this going with node 14 so -

the name result from the addon code line appears to equate to the title as specified in the appdmg.json file so my fix was to store the json title in localstorage (appdmg module) and retrieve it in the mac-alias module

appdmg.js (appdmg) Parsing JSON Specification step

add L126 localStorage.temp_jsonTitle = global.opts.title;

create.js (mac-alias) info.volume section

add L64 var cleanVolumePath = localStorage.temp_jsonTitle;

change L66 name: cleanVolumePath,

This hack works well for me and eliminates the addon code (volume.node) which is node version dependant. Not sure what else addon code is meant to do?

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

No branches or pull requests

1 participant