diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2019-06-28 13:13:28 +0300 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2019-08-16 08:30:41 +0000 |
commit | 28f92d37842ef087ab4f35ae7018b6366d0044e9 (patch) | |
tree | ed27594716da82765e7bb16c307c084f55ced48f | |
parent | 3946e2f8607282e054a76b119f1819b2535a0b8a (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 <katja.marttila@qt.io>
-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 |