dusionlike / electron-builder-encryptor

simple electron package encryption tool
MIT License
23 stars 7 forks source link

Missing 'MacOS' sub-directory in 'execPath' for Mac builds #11

Closed cstringer closed 5 months ago

cstringer commented 5 months ago

https://github.com/dusionlike/electron-builder-encryptor/blob/6bb97042619f78839d6e903b6c41544149a36d38/src/index.ts#L64

Currently, the executable path (execPath) for the compileToBytenode() function on MacOS builds is missing the "MacOS" subdirectory. For example:

// current:
"./release/mac-arm64/electron-builder-encryptor-demo.app/Contents/electron-builder-encryptor-demo"

// required:
"./release/mac-arm64/electron-builder-encryptor-demo.app/Contents/MacOS/electron-builder-encryptor-demo"

And thank you for this cool project, it is a very interesting idea!

dusionlike commented 5 months ago

Sorry, I don't have a Mac, so I can't verify your issue.

cstringer commented 5 months ago

@dusionlike that's quite alright, I'm on a Mac and can easily verify this issue for you.

First, refer to Apple's documentation on the structure of a macOS .app bundle: https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW1

MyApp.app/
   Contents/
      Info.plist
      MacOS/
      Resources/

As it mentions for the MacOS sub-directory: "(Required) Contains the application’s standalone executable code. Typically, this directory contains only one binary file with your application’s main entry point and statically linked code."

Here is the output from running npm run release on the "playground" code as-is:

image

By adding the correct MacOS subdirectory in index.ts, the build succeeds:

image image

Let me know if there's anything else I can provide to assist, thanks!

dusionlike commented 5 months ago

@cstringer It looks like you're right. Can you create a PR? thanks! ❤️