diff options
-rw-r--r-- | doc/scripting.qdoc | 6 | ||||
-rw-r--r-- | src/libs/installer/packagemanagercoredata.cpp | 10 |
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}. \row + \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); #endif m_variables.insert(QLatin1String("ApplicationsDir"), dir); + QString dirUser = dir; +#ifdef Q_OS_MACOS + dirUser = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).value(0); +#endif + m_variables.insert(QLatin1String("ApplicationsDirUser"), dirUser); + QString dirX86 = dir; QString dirX64 = dir; #ifdef Q_OS_WIN |