问题
It's shown as nwjs.app
in Finder but nw-demo.app
in Terminal.
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
:
回答1:
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.
回答2:
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.
来源:https://stackoverflow.com/questions/37890440/app-name-in-finder-not-matching-app-name-in-terminal