Commit 1fda4625 authored by Eike Ziller's avatar Eike Ziller
Browse files

Avoid explicit checks for windows host when working with file paths



We have fileNameCaseSensitivity and withExecutableSuffix et al.

Change-Id: I79bd2cd57e258c3f15673a661a49bab597d7afa4
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent de32c0fc
......@@ -684,7 +684,7 @@ FileName &FileName::appendString(QChar str)
QT_BEGIN_NAMESPACE
uint qHash(const Utils::FileName &a)
{
if (Utils::HostOsInfo::isWindowsHost())
if (Utils::HostOsInfo::fileNameCaseSensitivity() == Qt::CaseInsensitive)
return qHash(a.toString().toUpper());
return qHash(a.toString());
}
......
......@@ -224,9 +224,7 @@ bool AndroidDeployQtStep::init()
QString command = version->qmakeProperty("QT_HOST_BINS");
if (!command.endsWith(QLatin1Char('/')))
command += QLatin1Char('/');
command += QLatin1String("androiddeployqt");
if (Utils::HostOsInfo::isWindowsHost())
command += QLatin1String(".exe");
command += Utils::HostOsInfo::withExecutableSuffix(QLatin1String("androiddeployqt"));
QString deploymentMethod;
if (m_deployAction == MinistroDeployment)
......
......@@ -478,7 +478,7 @@ QString DocumentManager::fixFileName(const QString &fileName, FixMode fixmode)
s = QDir::cleanPath(s);
}
s = QDir::toNativeSeparators(s);
if (Utils::HostOsInfo::isWindowsHost())
if (Utils::HostOsInfo::fileNameCaseSensitivity() == Qt::CaseInsensitive)
s = s.toLower();
return s;
}
......
......@@ -181,7 +181,7 @@ QIcon BreakHandler::emptyIcon()
static inline bool fileNameMatch(const QString &f1, const QString &f2)
{
if (Utils::HostOsInfo::isWindowsHost())
if (Utils::HostOsInfo::fileNameCaseSensitivity() == Qt::CaseInsensitive)
return f1.compare(f2, Qt::CaseInsensitive) == 0;
return f1 == f2;
}
......
......@@ -127,8 +127,8 @@ BlackBerryApiLevelConfiguration::BlackBerryApiLevelConfiguration(const QVariantM
void BlackBerryApiLevelConfiguration::ctor()
{
QString host = qnxHost().toString();
FileName qmake4Path = QnxUtils::executableWithExtension(FileName::fromString(host + QLatin1String("/usr/bin/qmake")));
FileName qmake5Path = QnxUtils::executableWithExtension(FileName::fromString(host + QLatin1String("/usr/bin/qt5/qmake")));
FileName qmake4Path = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(host + QLatin1String("/usr/bin/qmake")));
FileName qmake5Path = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(host + QLatin1String("/usr/bin/qt5/qmake")));
if (qmake4Path.toFileInfo().exists())
m_qmake4BinaryFile = qmake4Path;
......
......@@ -146,16 +146,17 @@ void QnxBaseConfiguration::ctor(const FileName &envScript)
m_qnxHost = Utils::FileName::fromString(item.value);
}
FileName qccPath = QnxUtils::executableWithExtension(
FileName::fromString(m_qnxHost.toString() + QLatin1String("/usr/bin/qcc")));
FileName armlev7GdbPath = QnxUtils::executableWithExtension(
FileName::fromString(m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarm-gdb")));
if (!armlev7GdbPath.toFileInfo().exists())
armlev7GdbPath = QnxUtils::executableWithExtension(
FileName::fromString(m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarmv7-gdb")));
FileName x86GdbPath = QnxUtils::executableWithExtension(
FileName::fromString(m_qnxHost.toString() + QLatin1String("/usr/bin/ntox86-gdb")));
FileName qccPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(
m_qnxHost.toString() + QLatin1String("/usr/bin/qcc")));
FileName armlev7GdbPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(
m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarm-gdb")));
if (!armlev7GdbPath.toFileInfo().exists()) {
armlev7GdbPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(
m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarmv7-gdb")));
}
FileName x86GdbPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(
m_qnxHost.toString() + QLatin1String("/usr/bin/ntox86-gdb")));
if (qccPath.toFileInfo().exists())
m_qccCompiler = qccPath;
......
......@@ -178,14 +178,6 @@ QString QnxUtils::envFilePath(const QString &ndkPath, const QString &targetVersi
return envFile;
}
Utils::FileName QnxUtils::executableWithExtension(const Utils::FileName &fileName)
{
Utils::FileName result = fileName;
if (Utils::HostOsInfo::isWindowsHost())
result.appendString(QLatin1String(".exe"));
return result;
}
QString QnxUtils::bbDataDirPath()
{
const QString homeDir = QDir::homePath();
......@@ -272,11 +264,7 @@ QList<ConfigInstallInformation> QnxUtils::installedConfigs(const QString &config
QString QnxUtils::sdkInstallerPath(const QString &ndkPath)
{
QString sdkinstallPath;
if (Utils::HostOsInfo::isWindowsHost())
sdkinstallPath = ndkPath + QLatin1String("/qde.exe");
else
sdkinstallPath = ndkPath + QLatin1String("/qde");
QString sdkinstallPath = Utils::HostOsInfo::withExecutableSuffix(ndkPath + QLatin1String("/qde"));
if (QFileInfo(sdkinstallPath).exists())
return sdkinstallPath;
......
......@@ -69,7 +69,6 @@ public:
static QList<Utils::EnvironmentItem> qnxEnvironmentFromEnvFile(const QString &fileName);
static bool isValidNdkPath(const QString & ndkPath);
static QString envFilePath(const QString & ndkPath, const QString& targetVersion = QString());
static Utils::FileName executableWithExtension(const Utils::FileName &fileName);
static QString bbDataDirPath();
static QString bbqConfigPath();
static QString defaultTargetVersion(const QString& ndkPath);
......
......@@ -715,37 +715,26 @@ QString BaseQtVersion::findQtBinary(Binaries binary) const
QStringList possibleCommands;
switch (binary) {
case QmlScene: {
if (HostOsInfo::isWindowsHost())
possibleCommands << QLatin1String("qmlscene.exe");
else
possibleCommands << QLatin1String("qmlscene");
}
case QmlScene:
possibleCommands << HostOsInfo::withExecutableSuffix(QLatin1String("qmlscene"));
break;
case QmlViewer: {
if (HostOsInfo::isWindowsHost())
possibleCommands << QLatin1String("qmlviewer.exe");
else if (HostOsInfo::isMacHost())
if (HostOsInfo::isMacHost())
possibleCommands << QLatin1String("QMLViewer.app/Contents/MacOS/QMLViewer");
else
possibleCommands << QLatin1String("qmlviewer");
possibleCommands << HostOsInfo::withExecutableSuffix(QLatin1String("qmlviewer"));
}
break;
case Designer:
if (HostOsInfo::isWindowsHost())
possibleCommands << QLatin1String("designer.exe");
else if (HostOsInfo::isMacHost())
if (HostOsInfo::isMacHost())
possibleCommands << QLatin1String("Designer.app/Contents/MacOS/Designer");
else
possibleCommands << QLatin1String("designer");
possibleCommands << HostOsInfo::withExecutableSuffix(QLatin1String("designer"));
break;
case Linguist:
if (HostOsInfo::isWindowsHost())
possibleCommands << QLatin1String("linguist.exe");
else if (HostOsInfo::isMacHost())
if (HostOsInfo::isMacHost())
possibleCommands << QLatin1String("Linguist.app/Contents/MacOS/Linguist");
else
possibleCommands << QLatin1String("linguist");
possibleCommands << HostOsInfo::withExecutableSuffix(QLatin1String("linguist"));
break;
case Uic:
if (HostOsInfo::isWindowsHost()) {
......
......@@ -632,9 +632,9 @@ FileName QtVersionManager::findQMakeBinaryFromMakefile(const QString &makefile)
qDebug()<<"#~~ QMAKE is:"<<r1.cap(1).trimmed();
QFileInfo qmake(r1.cap(1).trimmed());
QString qmakePath = qmake.filePath();
if (HostOsInfo::isWindowsHost()
&& !qmakePath.endsWith(QLatin1String(".exe"))) {
qmakePath.append(QLatin1String(".exe"));
if (!QString::fromLatin1(QTC_HOST_EXE_SUFFIX).isEmpty()
&& !qmakePath.endsWith(QLatin1String(QTC_HOST_EXE_SUFFIX))) {
qmakePath.append(QLatin1String(QTC_HOST_EXE_SUFFIX));
}
// Is qmake still installed?
QFileInfo fi(qmakePath);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment