diff options
authorArttu Tarkiainen <>2019-06-28 13:13:28 +0300
committerArttu Tarkiainen <>2019-08-16 08:30:41 +0000
commit28f92d37842ef087ab4f35ae7018b6366d0044e9 (patch)
parent3946e2f8607282e054a76b119f1819b2535a0b8a (diff)
Change ApplicationsDir variable on macOS to return "/Applications"
QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation) first element returns $HOME/Applications, as being user writable it has a higher priority. Change the variable to return system wide /Applications as it is a more expected default. Add the user-specific applications directory as its own variable, and make associated documentation changes. Task-number: QTIFW-1011 Change-Id: Ia81a1f5dafdea8665d5f9fc1df3799e59858e5aa Reviewed-by: Katja Marttila <>
2 files changed, 15 insertions, 1 deletions
diff --git a/doc/scripting.qdoc b/doc/scripting.qdoc
index 708345c7d..e7e398c61 100644
--- a/doc/scripting.qdoc
+++ b/doc/scripting.qdoc
@@ -270,6 +270,12 @@
See also the table that lists examples of \l {Applications-directory-on-Windows}
{applications directories on Windows}.
+ \li ApplicationsDirUser
+ \li Applications directory for user-specific programs. This is useful on macOS,
+ on other platforms it is the same as \c ApplicationsDir.
+ For example, \c {$HOME/Applications} on macOS.
+ \row
\li ApplicationsDirX86
\li Applications Directory for 32 bit programs. This is useful on Windows,
on other platforms it is the same as \c ApplicationsDir.
diff --git a/src/libs/installer/packagemanagercoredata.cpp b/src/libs/installer/packagemanagercoredata.cpp
index ebacbf938..41c6f111c 100644
--- a/src/libs/installer/packagemanagercoredata.cpp
+++ b/src/libs/installer/packagemanagercoredata.cpp
@@ -111,10 +111,18 @@ void PackageManagerCoreData::setDynamicPredefinedVariables()
SHGetFolderPath(nullptr, CSIDL_PROGRAM_FILES, nullptr, 0, buffer);
dir = QString::fromWCharArray(buffer);
#elif defined (Q_OS_OSX)
- dir = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).value(0);
+ dir = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).value(1);
+ if (dir.isEmpty())
+ dir = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).value(0);
m_variables.insert(QLatin1String("ApplicationsDir"), dir);
+ QString dirUser = dir;
+#ifdef Q_OS_MACOS
+ dirUser = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).value(0);
+ m_variables.insert(QLatin1String("ApplicationsDirUser"), dirUser);
QString dirX86 = dir;
QString dirX64 = dir;
#ifdef Q_OS_WIN