App name in Finder not matching app name in Terminal
Asked Answered
P

2

1

It's shown as nwjs.app in Finder but nw-demo.app in Terminal.

screenshot

If I rename the app using mv nw-demo.app nw-demo2.app, it shows correctly in Finder. If I then rename it back using mv nw-demo2.app nw-demo.app, it shows as nwjs.app again. Strange.

The name should be nw-demo.app, that's what I want, but it's nwjs.app. I don't see anything in nw-demo.app/Contents/Info.plist or anywhere that would set it to nwjs. Here's the Info.plist:

plist screenshot

Photophore answered 17/6, 2016 at 21:12 Comment(2)
I think your executable in .app/Contents/MacOS is somehow responsible. The executable should technically be named nw-demo rather than nwjs ...Leathery
@l'L'l I've tried manually renaming that and editing the Info.plist to reference nw-demo instead of nwjs but it doesn't seem to make a difference. Plus, I've other apps which use an nwjs executable like that and they're fine.Photophore
P
4

All I had to do was delete nw-demo.app/Contents/Resources/*.lproj. Apparently those files are used for internationalization and affect the display name.

Photophore answered 18/6, 2016 at 21:40 Comment(0)
M
8

If your Info.plist contains the CFBundleDisplayName key (shown as "Bundle display name" in your screenshot) and if its value matches the name of the app bundle on disk (minus the .app extension), then Launch Services searches the app bundle for a InfoPlist.strings file among the localizations matching the user's selected language(s). If it finds one and that has a localization for the CFBundleName key, then it uses that localization as the display name for the bundle.

The Finder, Dock, file dialogs, etc. all use the display name as obtained from Launch Services when presenting files and directories to the user.

The comparison of the Info.plist value to the name on disk is to allow users to rename app bundles however they like. If the user has renamed it, the strings won't match and there's no attempt to localize the user-supplied name. However, if the strings do match, that suggests the user hasn't renamed it (or has carefully renamed it back to the real original value, not the apparent original value), so the app-provided localization is respected.

Mariel answered 18/6, 2016 at 22:0 Comment(2)
Thank you so much for this answer! I have been trying to change the display name on disk for a while, and this finally solved it for me.Whitleather
P.S.: The chosen localized display name also affect the app's title in notifications, which is what I was looking for in particular.Whitleather
P
4

All I had to do was delete nw-demo.app/Contents/Resources/*.lproj. Apparently those files are used for internationalization and affect the display name.

Photophore answered 18/6, 2016 at 21:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.