Utils: Fix compile on unix

amends 72b35aa12b

Change-Id: I934ef8420b998db367f004d2f58782abdc843af9
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2020-06-16 09:59:51 +02:00
committed by Alessandro Portale
parent 8efe0df9dc
commit 5bd0894813

View File

@@ -47,24 +47,28 @@ struct Tool
QStringList additionalSearchDirs; QStringList additionalSearchDirs;
}; };
static QStringList additionalInstallDirs(const QString &registryKey, const QString &valueName)
{
#if defined(Q_OS_WIN)
const QSettings settings64(registryKey, QSettings::Registry64Format);
const QSettings settings32(registryKey, QSettings::Registry32Format);
return {settings64.value(valueName).toString(), settings32.value(valueName).toString()};
#else
Q_UNUSED(registryKey)
Q_UNUSED(valueName)
return {};
#endif
}
static const QVector<Tool> &sTools() static const QVector<Tool> &sTools()
{ {
static QVector<Tool> tools; static QVector<Tool> tools;
if (tools.isEmpty()) { if (tools.isEmpty()) {
tools << Tool{{"unzip"}, {"-o", "%{src}", "-d", "%{dest}"}, {"application/zip"}, {}}; tools << Tool{{"unzip"}, {"-o", "%{src}", "-d", "%{dest}"}, {"application/zip"}, {}};
QStringList additional7ZipDirs;
if (Utils::HostOsInfo::isWindowsHost()) {
const QSettings settings64("HKEY_CURRENT_USER\\Software\\7-Zip",
QSettings::Registry64Format);
const QSettings settings32("HKEY_CURRENT_USER\\Software\\7-Zip",
QSettings::Registry32Format);
additional7ZipDirs << settings64.value("Path").toString()
<< settings32.value("Path").toString();
}
tools << Tool{{"7z"}, tools << Tool{{"7z"},
{"x", "-o%{dest}", "-y", "%{src}"}, {"x", "-o%{dest}", "-y", "%{src}"},
{"application/zip", "application/x-7z-compressed"}, {"application/zip", "application/x-7z-compressed"},
additional7ZipDirs}; additionalInstallDirs("HKEY_CURRENT_USER\\Software\\7-Zip", "Path")};
tools << Tool{{"tar"}, tools << Tool{{"tar"},
{"xvf", "%{src}"}, {"xvf", "%{src}"},
{"application/zip", "application/x-tar", "application/x-7z-compressed"}, {"application/zip", "application/x-tar", "application/x-7z-compressed"},
@@ -72,15 +76,8 @@ static const QVector<Tool> &sTools()
tools << Tool{{"tar"}, {"xvzf", "%{src}"}, {"application/x-compressed-tar"}, {}}; tools << Tool{{"tar"}, {"xvzf", "%{src}"}, {"application/x-compressed-tar"}, {}};
tools << Tool{{"tar"}, {"xvJf", "%{src}"}, {"application/x-xz-compressed-tar"}, {}}; tools << Tool{{"tar"}, {"xvJf", "%{src}"}, {"application/x-xz-compressed-tar"}, {}};
tools << Tool{{"tar"}, {"xvjf", "%{src}"}, {"application/x-bzip-compressed-tar"}, {}}; tools << Tool{{"tar"}, {"xvjf", "%{src}"}, {"application/x-bzip-compressed-tar"}, {}};
QStringList additionalCMakeDirs; const QStringList additionalCMakeDirs = additionalInstallDirs(
if (Utils::HostOsInfo::isWindowsHost()) { "HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\CMake", "InstallDir");
const QSettings settings64("HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\CMake",
QSettings::Registry64Format);
const QSettings settings32("HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\CMake",
QSettings::Registry32Format);
additionalCMakeDirs << settings64.value("InstallDir").toString()
<< settings32.value("InstallDir").toString();
}
tools << Tool{{"cmake"}, tools << Tool{{"cmake"},
{"-E", "tar", "xvf", "%{src}"}, {"-E", "tar", "xvf", "%{src}"},
{"application/zip", "application/x-tar", "application/x-7z-compressed"}, {"application/zip", "application/x-tar", "application/x-7z-compressed"},