nwutils/nw-builder

[osx64] Copyright is not configurable - always set to default nwjs

rocketVibes opened this issue · 10 comments

Issue Type

  • Bug Report
  • Feature Request
  • Other

Current/Missing Behaviour

Given the following:

await nwbuild({
        mode: 'build',
        version: '0.70.0',
        flavor: 'normal',
        platform: 'osx',
        arch: "x64",
        outDir: './build/example-tool/osx64',
        srcDir: './Settings.json ./package.json ./config.json ./dist/**,
        app: {
            name: 'example-tool',
            CFBundleDisplayName: 'Example Tool',
            CFBundleVersion: version,
            CFBundleShortVersionString: version,
            companyName: 'rocketVibes International, Inc.',
            NSHumanReadableCopyright: `Copyright ${new Date().getFullYear()} rocketVibes International, Inc.  All rights reserved.`,
            originalFilename: 'example-tool.exe',
            icon: './dist/assets/images/example_tool.ico'
        }
    });

Copyright is still default NWJS copyright.

Expected/Proposed Behaviour

Copyright should have value provided.

Additional Info

It appears that the English InfoPlist.strings CFBundleGetInfoString value (example path: /build/example-tool/osx64/example-tool.app/Contents/Resources/en.lproj) is overriding the NSHumanReadableCopyright value set in the Info.plist -- so the nwjs copyright is coming through instead of the one I set.

  • Package version: 4.3.1
  • Operating System: MacOS Ventura
  • Node version: 18.16.0
  • NW.js version: 0.70.0

I'm pretty sure CFBundleGetInfoString is no longer supported/used in OSX 10 and above. Let me see what I can do about this.

5864c5b
Updating NSHumanReadableCopyright in Contents/Resources/en.lproj/InfoPlist.strings did not update the copyright.

8ccfddf
On the other hand, adding NSHumanReadableCopyright inside Info.plist as mentioned in Apple docs also does not work.

@rocketVibes let me know if you're able to find a solution for this. In the mean time, I'll keep trying.

@zkrige have you come across this issue before? how do you set the copyright in your apps?

@rocketVibes I looked into what other nw builders were doing. Found this interesting:
https://github.com/nwutils/nwjs-packager/blob/55f9d224ddea0301405508254303593d9ae266fd/bin/builder/BuilderOsx.js#L53

I a bit busy atm. If you're able to incorporate some changes from nwjs-packager and open a PR that would be great!

zkrige commented

I run a manual plist tool just after build which sets plist values

Could you maybe paste some of the code here?

zkrige commented

I'm traveling so I can't find the exact code but I had a quick look at build scripts on mobile

Here is a plistbuddy command that sets the display name in the renderer helper. You can do similar for any fields in plist

#/usr/libexec/PlistBuddy -c Set :CFBundleDisplayName $NAME Helper (RENDERER)" "${OUTDIRECTORY}/${NAME}.app/Contents/Frameworks/nwjs Framework.framework/Helpers/nwjs Helper (Renderer).app/Contents/Info.plist"

Ah cool, thanks!

@zkrige Whenever you get the time, could you post the code to update the NSHumanCopyright property?

zkrige commented

ah so upon further inspection it appears the copyright is in nwjs.app/Contents/Resources/en.lproj/InfoPlist.strings

NSHumanReadableCopyright = "Copyright 2023 The Chromium Authors, NW.js, Node.js. All rights reserved.";

its a plain key value file so you can just use sed to replace it