How to set QCoreApplication organization name and domain correctly on macOS?
-
QCoreApplication
has methodssetOrganizationDomain()
,setOrganizationName()
andsetApplicationName()
.If I set the domain as
com.myapp
and application name asMyApp
, my local settings as provided byQStandardPaths::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? -
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.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.
-
@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 withQStandardPaths
and 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 ?