Why does App.Description not return anything? Bug?

  1. 5 months ago

    William K

    Jun 10 Pre-Release Testers, Xojo Pro Chico, CA

    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?

    Cheers.

    -bill k

  2. Alberto D

    Jun 10 Pre-Release Testers Answer

    Found this: Feedback Case #54580

  3. William K

    Jun 10 Pre-Release Testers, Xojo Pro Chico, CA

    So not-a-bug. Interesting.

    Sure would be nice to be able to get at the App name somehow without resorting to declare witchcraft or 3rd party plugins...

  4. Alberto D

    Jun 10 Pre-Release Testers
    Edited 5 months ago

    To check the application name you can use App.ExecutableFile.Name no? or is other value what you want?

  5. William K

    Jun 10 Pre-Release Testers, Xojo Pro Chico, CA

    Yes, that's exactly what I want. Just being dense. Cheers.

  6. Sam R

    Jun 10 Pre-Release Testers, Xojo Pro, Third Party Store Hengchun, Pingtung, Taiwan

    @WilliamKoperwhats So not-a-bug. Interesting.

    Sure would be nice to be able to get at the App name somehow without resorting to declare witchcraft or 3rd party plugins...

    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

  7. James D

    Jun 11 Pre-Release Testers, Xojo Pro Europe (Switzerland)

    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.

  8. Gavin S

    Jun 11 Pre-Release Testers UK

    I'd like a clean way to grab the App name also but in lieu of that, this is good enough for me:

    dim appName as String = App.ExecutableFile.Name
    appName = appName.Replace(".app", "")
    appName = appName.Replace(".exe", "")
    appName = appName.Replace(".debug", "")
    appName = appName.Replace("Debug", "")
  9. Dale A

    Jun 11 San Diego, California, USA

    This is the way I strip the extensions from the App Name.

    Public Function StripFileExtension(Filename As String) as String
        // Modified to allow for names without extension and names that start with a period.
        Dim fn() As String
        
        fn = Split(fileName, ".")
        If fn(0) = "" Then 
          If fn.Ubound = 1 Then Return fileName
        End If
        
        If fn.Ubound > 0 Then fn.Remove(fn.Ubound)
        Return Join(fn,".")
        
    End Function
  10. Norman P

    Jun 11 Pre-Release Testers, Xojo Pro great-white-software.com/blog
    Edited 5 months ago

    There are several possible names
    1) the Bundle Name as originally set in the plist
    2) the executable name
    3) 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)
    -image-

  11. William K

    Jun 11 Pre-Release Testers, Xojo Pro Chico, CA

    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".

  12. Norman P

    Jun 11 Pre-Release Testers, Xojo Pro great-white-software.com/blog
    Edited 5 months ago

    @WilliamKoperwhats 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.

    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

    @WilliamKoperwhats Three things to note: 1. Strange that there is no way of accessing the "Mac App Name" or "Windows App Name" information programmatically,

    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

    @WilliamKoperwhats 2. It sounds like the "Description" field really isn't a "Shared" setting if it doesn't actually apply to macOS apps

    Shared may not mean "across every target"
    Windows & Linux use it I believe and it is common to them

    @WilliamKoperwhats 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".

    I have no idea how Xojo's build process decides what toset that to
    Report it as a bug as that does seem on macOS it should say "©Xojo Inc." or something

  13. Alberto D

    Jun 11 Pre-Release Testers

    @Norman P Shared may not mean "across every target"
    Windows & Linux use it I believe and it is common to them

    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.

  14. Norman P

    Jun 11 Pre-Release Testers, Xojo Pro great-white-software.com/blog

    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

or Sign Up to reply!