Closed Slakinov closed 4 months ago
Huh. Looks like the issue was to do with my entitlements.plist
I was referencing it in my forge.config.js
using an old format from some out-of-date docs, and hadn't included 'disable library validation'. Here's what worked for me in case it helps anyone else:
forge.config.js
module.exports = {
packagerConfig: {
asar: false,
osxSign: {
hardenedRuntime: false,
identity: "Developer ID Application: XXXXXX (XXXXXXXX)",
optionsForFile: filePath => { return { entitlements: './entitlements.plist' } },
signatureFlags: "library",
},
...
entitlements.plist
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key><true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key><true/>
<key>com.apple.security.cs.disable-library-validation</key><true/>
</dict>
</plist>
The following has only been tested on Mac M1 so far. The test electron app included in this repo works for me in dev mode and as a built app (after fixing its package.json).
Our game is using Electron Forge, in dev mode we can successfully init steamworks.js with our game's appId, retrieve playerName etc. and trigger some achievements. Awesome.
But as a production build, steamworks.init() throws this error:
Failed to load module '/Users/xxxxxxxx/Library/Application Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/steamclient.dylib'
The file it's looking for is indeed in that folder. I've read #75 and have tried all of the solutions that seem relevant but none of it makes any difference. I also tried copying the dependencies from /redistributable_bin "into the root of your build" as mentioned in the README of this repo and that made no difference either (these instructions are pretty vague).
Can anyone explain:
Why does the dev build work?
Does the built .app version not have permission to access the .dylib depencency from the Steam App Support folders?
Why is the test electron app from this repo able to access the Steam App Support folders?
Thanks in advance for any clues.