I am in the process of generalizing a few code modules that I intend to use in a number of different Mac/Windows applications (version numbering, software updater, etc). As far as I can tell, there’s no easy built-in way to get at the application name (i.e. to display in a simple “About” dialog), so I was hoping to use the “Description” field in the Shared Build Settings to store the same information. Unfortunately App.Description doesn’t return anything. It seems like everything else Is working as expected (App.Copyright, App.Version, etc.), but Description always returns a null string irregardless of what I put in there.
I can use MBS methods to get the running app name, and I’ll end up doing this for the time being, but this smells like a bug to me (2019r1.1). Am I wrong?
Sure would be nice to be able to get at the App name somehow without resorting to declare witchcraft or 3rd party plugins…[/quote]
Add a constant to the app class called “appName” (or something), set your application name there. Then in the build settings, use this voodoo to set the name #app.appName
Create a template application that includes your common modules, an App class with common constants your modules need, dialogs, controls and anything else your apps have in common. Then built your apps from the template and edit the constants as needed.
the actual visible name in the Finder
In my case I rename the app bundles for Xojo with the version # so 2019r1.1 is named “Xojo 2019r1.1” in the Finder, has a bundle name in the plist of “Xojo” and the executable name of “Xojo”
But this does NOT have to be the case
The app bundle name could be “Foo” the plist bundle name entry “Bar” and the plist entry for the executable “Baz” (since the plist also has a separate entry for what executable to run when the bundle is opened - see CFBundleExecutable)
Then the question is “which one is the correct one to show your user ?”
EDIT ; and the description might at best be stuff in the “Comments” in the get info pane - which is stored as an extended attribute & users can change (hence if you put it in a constant and use that its -safe- it just doesnt have a natural place to go in a built binary)
As for the description it doesnt show anywhere in macOS X (I dont recall if it did was back in the Classic Mac OS days or not)
Norman, I agree with you, the “AppName” can mean a lot of different things, but for this particular purpose I’m wanting with the name that appears in the menubar or the actual visible name in the Finder. The former would most likely be shorter for most applications. Sam’s suggestion of putting a constant in App class is likely what I’ll do.
Three things to note: 1. Strange that there is no way of accessing the “Mac App Name” or “Windows App Name” information programmatically, 2. It sounds like the “Description” field really isn’t a “Shared” setting if it doesn’t actually apply to macOS apps, and 3. the “Copyright” field (finally renamed from “Long Version” - thank you BTW) of the Mac version of the Xojo 2019r1.1 app appears to have been entered incorrectly. When I did a “Get Info” on the application file, it just says “.1”.
That is the Bundle name, not the plist entry nor the truncated & fixed name of the executable in Contents/MacOS
And that is only retrievable properly using a declare or a plugin and WILL change if the user happens to rename the app bundle like I mentioned I do
However the two are NOT identical
When I rename the app bundle what shows in the menu bar is still the name as it was set in the Plist not the name shown in the Finder
Dunno if there is a FR for this - there may be
But given what I just wrote above “which name is it you want” is a relevant question as there could be as many as 3 on macOS
Shared may not mean “across every target”
Windows & Linux use it I believe and it is common to them
[quote=440997:@Norman Palardy]Shared may not mean “across every target”
Windows & Linux use it I believe and it is common to them[/quote]
I think it makes more sense if Shared mean “across every target”. It is strange that there is Description in Shared and File Description as Windows specific. If you put something in File Description it overrides what it is in Description.
And what about Supports Dark Mode. Why it is that in Shared, from what I read is a macOS only option. For me, the right place is under macOS - Build options.
well if you put is on each target and its common to 2 and you change the “windows description” and the “linux description” changes it would seem to be a bug
or internally in the IDE they have to have multiple properties to hold this separately - which if you check there is only one entry in the project manifest when you save as text format
the simple work around it to just use a constant and set the description from that then the constant is baked in already
Dark mode could be moved to JUST the macOS pane until / unless Windows & Linux get some kind of support