How to set QCoreApplication organization name and domain correctly on macOS?
-
QCoreApplicationhas methodssetOrganizationDomain(),setOrganizationName()andsetApplicationName().If I set the domain as
com.myappand application name asMyApp, my local settings as provided byQStandardPaths::AppDataLocationin 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::AppDataLocationwould point to macOS-style settings path? -
Hi,
There's nothing wrong with that. Take for example Spotlight, it uses com.apple.spotlight.
-
Hi,
There's nothing wrong with that. Take for example Spotlight, it uses com.apple.spotlight.
-
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.BasicCalcTherefore, the app support path is:
~/Library/Application Support/mpergand/BasicalcThe preferences file name (QSettings) is:
fr.mpergand.BasicCalc.plistAnd it is what I expected because it's how it must work on Mac.
-
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.BasicCalcTherefore, the app support path is:
~/Library/Application Support/mpergand/BasicalcThe preferences file name (QSettings) is:
fr.mpergand.BasicCalc.plistAnd it is what I expected because it's how it must work on Mac.
@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 withQStandardPathsand proper settings insetApplication Name/Organization/etc.()APIs. -
@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 withQStandardPathsand proper settings insetApplication Name/Organization/etc.()APIs.@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 ? -
@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 ?