4
0
mirror of https://github.com/QuasarApp/installer-framework.git synced 2025-05-04 09:19:34 +00:00

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>
This commit is contained in:
Arttu Tarkiainen 2019-06-28 13:13:28 +03:00
parent 3946e2f860
commit 28f92d3784
2 changed files with 15 additions and 1 deletions

@ -269,6 +269,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,

@ -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