Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to set QCoreApplication organization name and domain correctly on macOS?
Forum Updated to NodeBB v4.3 + New Features

How to set QCoreApplication organization name and domain correctly on macOS?

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 2.6k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    ribtoks
    wrote on last edited by
    #1

    QCoreApplication has methods setOrganizationDomain(), setOrganizationName() and setApplicationName().

    If I set the domain as com.myapp and application name as MyApp, my local settings as provided by QStandardPaths::AppDataLocation in macOS are still located at ~\Library\Application Support\MyApp\... instead of ~\Library\Application Support\com.myapp.MyApp\....

    What is the correct way to set them up so QStandardPaths::AppDataLocation would point to macOS-style settings path?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      There's nothing wrong with that. Take for example Spotlight, it uses com.apple.spotlight.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      R 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        There's nothing wrong with that. Take for example Spotlight, it uses com.apple.spotlight.

        R Offline
        R Offline
        ribtoks
        wrote on last edited by
        #3

        @SGaist Great so how can I achieve the same path for my app com.myapp.MyApp?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mpergand
          wrote on last edited by
          #4

          Let's clarify a few things.
          For one of my apps, I define this:

          app.setApplicationName(QString("BasicCalc"));
          app.setOrganizationName(QString("mpergand"));
          app.setOrganizationDomain(QString("mpergand.fr"));
          

          After compilation I see this in the Info.plist :

          Bundle name = BasicCalc
          Bundle Identifier = fr.mpergand.BasicCalc
          

          Therefore, the app support path is:

          ~/Library/Application Support/mpergand/Basicalc
          

          The preferences file name (QSettings) is:

          fr.mpergand.BasicCalc.plist
          

          And it is what I expected because it's how it must work on Mac.

          R 1 Reply Last reply
          0
          • M mpergand

            Let's clarify a few things.
            For one of my apps, I define this:

            app.setApplicationName(QString("BasicCalc"));
            app.setOrganizationName(QString("mpergand"));
            app.setOrganizationDomain(QString("mpergand.fr"));
            

            After compilation I see this in the Info.plist :

            Bundle name = BasicCalc
            Bundle Identifier = fr.mpergand.BasicCalc
            

            Therefore, the app support path is:

            ~/Library/Application Support/mpergand/Basicalc
            

            The preferences file name (QSettings) is:

            fr.mpergand.BasicCalc.plist
            

            And it is what I expected because it's how it must work on Mac.

            R Offline
            R Offline
            ribtoks
            wrote on last edited by
            #5

            @mpergand Hey. Thanks for providing an example. All is good with the exception that it's not how it must work on Mac. This is how it may work. In fact apps that run in Sandbox (from AppStore) use different path. And other apps may have path ~/Library/Application Support/fr.mpergand.BasicCalc/ for settings directory. The question was if it is possible to achieve this in Qt with QStandardPaths and proper settings in setApplication Name/Organization/etc.() APIs.

            M 1 Reply Last reply
            0
            • R ribtoks

              @mpergand Hey. Thanks for providing an example. All is good with the exception that it's not how it must work on Mac. This is how it may work. In fact apps that run in Sandbox (from AppStore) use different path. And other apps may have path ~/Library/Application Support/fr.mpergand.BasicCalc/ for settings directory. The question was if it is possible to achieve this in Qt with QStandardPaths and proper settings in setApplication Name/Organization/etc.() APIs.

              M Offline
              M Offline
              mpergand
              wrote on last edited by mpergand
              #6

              @ribtoks said in How to set QCoreApplication organization name and domain correctly on macOS?:

              @mpergand Hey. Thanks for providing an example. All is good with the exception that it's not how it must work on Mac. This is how it may work. In fact apps that run in Sandbox (from AppStore) use different path.

              My bad, I was not aware of this (I'm not using AppleStore)
              Maybe you have to add a specific entry in the info.plist for the sandbox ?

              R 1 Reply Last reply
              0
              • M mpergand

                @ribtoks said in How to set QCoreApplication organization name and domain correctly on macOS?:

                @mpergand Hey. Thanks for providing an example. All is good with the exception that it's not how it must work on Mac. This is how it may work. In fact apps that run in Sandbox (from AppStore) use different path.

                My bad, I was not aware of this (I'm not using AppleStore)
                Maybe you have to add a specific entry in the info.plist for the sandbox ?

                R Offline
                R Offline
                ribtoks
                wrote on last edited by
                #7

                @mpergand The thing is that whether in sandbox or not, app learns about appropriate paths available for writing using system calls (like NSLibraryDirectory). I'm only trying to learn if it's possible to achieve this with Qt.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved