forked from qt-creator/qt-creator
Avoid explicit checks for windows host when working with file paths
We have fileNameCaseSensitivity and withExecutableSuffix et al. Change-Id: I79bd2cd57e258c3f15673a661a49bab597d7afa4 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -684,7 +684,7 @@ FileName &FileName::appendString(QChar str)
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
uint qHash(const Utils::FileName &a)
|
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().toUpper());
|
||||||
return qHash(a.toString());
|
return qHash(a.toString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -224,9 +224,7 @@ bool AndroidDeployQtStep::init()
|
|||||||
QString command = version->qmakeProperty("QT_HOST_BINS");
|
QString command = version->qmakeProperty("QT_HOST_BINS");
|
||||||
if (!command.endsWith(QLatin1Char('/')))
|
if (!command.endsWith(QLatin1Char('/')))
|
||||||
command += QLatin1Char('/');
|
command += QLatin1Char('/');
|
||||||
command += QLatin1String("androiddeployqt");
|
command += Utils::HostOsInfo::withExecutableSuffix(QLatin1String("androiddeployqt"));
|
||||||
if (Utils::HostOsInfo::isWindowsHost())
|
|
||||||
command += QLatin1String(".exe");
|
|
||||||
|
|
||||||
QString deploymentMethod;
|
QString deploymentMethod;
|
||||||
if (m_deployAction == MinistroDeployment)
|
if (m_deployAction == MinistroDeployment)
|
||||||
|
|||||||
@@ -478,7 +478,7 @@ QString DocumentManager::fixFileName(const QString &fileName, FixMode fixmode)
|
|||||||
s = QDir::cleanPath(s);
|
s = QDir::cleanPath(s);
|
||||||
}
|
}
|
||||||
s = QDir::toNativeSeparators(s);
|
s = QDir::toNativeSeparators(s);
|
||||||
if (Utils::HostOsInfo::isWindowsHost())
|
if (Utils::HostOsInfo::fileNameCaseSensitivity() == Qt::CaseInsensitive)
|
||||||
s = s.toLower();
|
s = s.toLower();
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ QIcon BreakHandler::emptyIcon()
|
|||||||
|
|
||||||
static inline bool fileNameMatch(const QString &f1, const QString &f2)
|
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.compare(f2, Qt::CaseInsensitive) == 0;
|
||||||
return f1 == f2;
|
return f1 == f2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,8 +127,8 @@ BlackBerryApiLevelConfiguration::BlackBerryApiLevelConfiguration(const QVariantM
|
|||||||
void BlackBerryApiLevelConfiguration::ctor()
|
void BlackBerryApiLevelConfiguration::ctor()
|
||||||
{
|
{
|
||||||
QString host = qnxHost().toString();
|
QString host = qnxHost().toString();
|
||||||
FileName qmake4Path = QnxUtils::executableWithExtension(FileName::fromString(host + QLatin1String("/usr/bin/qmake")));
|
FileName qmake4Path = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(host + QLatin1String("/usr/bin/qmake")));
|
||||||
FileName qmake5Path = QnxUtils::executableWithExtension(FileName::fromString(host + QLatin1String("/usr/bin/qt5/qmake")));
|
FileName qmake5Path = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(host + QLatin1String("/usr/bin/qt5/qmake")));
|
||||||
if (qmake4Path.toFileInfo().exists())
|
if (qmake4Path.toFileInfo().exists())
|
||||||
m_qmake4BinaryFile = qmake4Path;
|
m_qmake4BinaryFile = qmake4Path;
|
||||||
|
|
||||||
|
|||||||
@@ -146,16 +146,17 @@ void QnxBaseConfiguration::ctor(const FileName &envScript)
|
|||||||
m_qnxHost = Utils::FileName::fromString(item.value);
|
m_qnxHost = Utils::FileName::fromString(item.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName qccPath = QnxUtils::executableWithExtension(
|
FileName qccPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(
|
||||||
FileName::fromString(m_qnxHost.toString() + QLatin1String("/usr/bin/qcc")));
|
m_qnxHost.toString() + QLatin1String("/usr/bin/qcc")));
|
||||||
FileName armlev7GdbPath = QnxUtils::executableWithExtension(
|
FileName armlev7GdbPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(
|
||||||
FileName::fromString(m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarm-gdb")));
|
m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarm-gdb")));
|
||||||
if (!armlev7GdbPath.toFileInfo().exists())
|
if (!armlev7GdbPath.toFileInfo().exists()) {
|
||||||
armlev7GdbPath = QnxUtils::executableWithExtension(
|
armlev7GdbPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(
|
||||||
FileName::fromString(m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarmv7-gdb")));
|
m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarmv7-gdb")));
|
||||||
|
}
|
||||||
|
|
||||||
FileName x86GdbPath = QnxUtils::executableWithExtension(
|
FileName x86GdbPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(
|
||||||
FileName::fromString(m_qnxHost.toString() + QLatin1String("/usr/bin/ntox86-gdb")));
|
m_qnxHost.toString() + QLatin1String("/usr/bin/ntox86-gdb")));
|
||||||
|
|
||||||
if (qccPath.toFileInfo().exists())
|
if (qccPath.toFileInfo().exists())
|
||||||
m_qccCompiler = qccPath;
|
m_qccCompiler = qccPath;
|
||||||
|
|||||||
@@ -178,14 +178,6 @@ QString QnxUtils::envFilePath(const QString &ndkPath, const QString &targetVersi
|
|||||||
return envFile;
|
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()
|
QString QnxUtils::bbDataDirPath()
|
||||||
{
|
{
|
||||||
const QString homeDir = QDir::homePath();
|
const QString homeDir = QDir::homePath();
|
||||||
@@ -272,11 +264,7 @@ QList<ConfigInstallInformation> QnxUtils::installedConfigs(const QString &config
|
|||||||
|
|
||||||
QString QnxUtils::sdkInstallerPath(const QString &ndkPath)
|
QString QnxUtils::sdkInstallerPath(const QString &ndkPath)
|
||||||
{
|
{
|
||||||
QString sdkinstallPath;
|
QString sdkinstallPath = Utils::HostOsInfo::withExecutableSuffix(ndkPath + QLatin1String("/qde"));
|
||||||
if (Utils::HostOsInfo::isWindowsHost())
|
|
||||||
sdkinstallPath = ndkPath + QLatin1String("/qde.exe");
|
|
||||||
else
|
|
||||||
sdkinstallPath = ndkPath + QLatin1String("/qde");
|
|
||||||
|
|
||||||
if (QFileInfo(sdkinstallPath).exists())
|
if (QFileInfo(sdkinstallPath).exists())
|
||||||
return sdkinstallPath;
|
return sdkinstallPath;
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ public:
|
|||||||
static QList<Utils::EnvironmentItem> qnxEnvironmentFromEnvFile(const QString &fileName);
|
static QList<Utils::EnvironmentItem> qnxEnvironmentFromEnvFile(const QString &fileName);
|
||||||
static bool isValidNdkPath(const QString & ndkPath);
|
static bool isValidNdkPath(const QString & ndkPath);
|
||||||
static QString envFilePath(const QString & ndkPath, const QString& targetVersion = QString());
|
static QString envFilePath(const QString & ndkPath, const QString& targetVersion = QString());
|
||||||
static Utils::FileName executableWithExtension(const Utils::FileName &fileName);
|
|
||||||
static QString bbDataDirPath();
|
static QString bbDataDirPath();
|
||||||
static QString bbqConfigPath();
|
static QString bbqConfigPath();
|
||||||
static QString defaultTargetVersion(const QString& ndkPath);
|
static QString defaultTargetVersion(const QString& ndkPath);
|
||||||
|
|||||||
@@ -715,37 +715,26 @@ QString BaseQtVersion::findQtBinary(Binaries binary) const
|
|||||||
|
|
||||||
QStringList possibleCommands;
|
QStringList possibleCommands;
|
||||||
switch (binary) {
|
switch (binary) {
|
||||||
case QmlScene: {
|
case QmlScene:
|
||||||
if (HostOsInfo::isWindowsHost())
|
possibleCommands << HostOsInfo::withExecutableSuffix(QLatin1String("qmlscene"));
|
||||||
possibleCommands << QLatin1String("qmlscene.exe");
|
|
||||||
else
|
|
||||||
possibleCommands << QLatin1String("qmlscene");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case QmlViewer: {
|
case QmlViewer: {
|
||||||
if (HostOsInfo::isWindowsHost())
|
if (HostOsInfo::isMacHost())
|
||||||
possibleCommands << QLatin1String("qmlviewer.exe");
|
|
||||||
else if (HostOsInfo::isMacHost())
|
|
||||||
possibleCommands << QLatin1String("QMLViewer.app/Contents/MacOS/QMLViewer");
|
possibleCommands << QLatin1String("QMLViewer.app/Contents/MacOS/QMLViewer");
|
||||||
else
|
else
|
||||||
possibleCommands << QLatin1String("qmlviewer");
|
possibleCommands << HostOsInfo::withExecutableSuffix(QLatin1String("qmlviewer"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Designer:
|
case Designer:
|
||||||
if (HostOsInfo::isWindowsHost())
|
if (HostOsInfo::isMacHost())
|
||||||
possibleCommands << QLatin1String("designer.exe");
|
|
||||||
else if (HostOsInfo::isMacHost())
|
|
||||||
possibleCommands << QLatin1String("Designer.app/Contents/MacOS/Designer");
|
possibleCommands << QLatin1String("Designer.app/Contents/MacOS/Designer");
|
||||||
else
|
else
|
||||||
possibleCommands << QLatin1String("designer");
|
possibleCommands << HostOsInfo::withExecutableSuffix(QLatin1String("designer"));
|
||||||
break;
|
break;
|
||||||
case Linguist:
|
case Linguist:
|
||||||
if (HostOsInfo::isWindowsHost())
|
if (HostOsInfo::isMacHost())
|
||||||
possibleCommands << QLatin1String("linguist.exe");
|
|
||||||
else if (HostOsInfo::isMacHost())
|
|
||||||
possibleCommands << QLatin1String("Linguist.app/Contents/MacOS/Linguist");
|
possibleCommands << QLatin1String("Linguist.app/Contents/MacOS/Linguist");
|
||||||
else
|
possibleCommands << HostOsInfo::withExecutableSuffix(QLatin1String("linguist"));
|
||||||
possibleCommands << QLatin1String("linguist");
|
|
||||||
break;
|
break;
|
||||||
case Uic:
|
case Uic:
|
||||||
if (HostOsInfo::isWindowsHost()) {
|
if (HostOsInfo::isWindowsHost()) {
|
||||||
|
|||||||
@@ -632,9 +632,9 @@ FileName QtVersionManager::findQMakeBinaryFromMakefile(const QString &makefile)
|
|||||||
qDebug()<<"#~~ QMAKE is:"<<r1.cap(1).trimmed();
|
qDebug()<<"#~~ QMAKE is:"<<r1.cap(1).trimmed();
|
||||||
QFileInfo qmake(r1.cap(1).trimmed());
|
QFileInfo qmake(r1.cap(1).trimmed());
|
||||||
QString qmakePath = qmake.filePath();
|
QString qmakePath = qmake.filePath();
|
||||||
if (HostOsInfo::isWindowsHost()
|
if (!QString::fromLatin1(QTC_HOST_EXE_SUFFIX).isEmpty()
|
||||||
&& !qmakePath.endsWith(QLatin1String(".exe"))) {
|
&& !qmakePath.endsWith(QLatin1String(QTC_HOST_EXE_SUFFIX))) {
|
||||||
qmakePath.append(QLatin1String(".exe"));
|
qmakePath.append(QLatin1String(QTC_HOST_EXE_SUFFIX));
|
||||||
}
|
}
|
||||||
// Is qmake still installed?
|
// Is qmake still installed?
|
||||||
QFileInfo fi(qmakePath);
|
QFileInfo fi(qmakePath);
|
||||||
|
|||||||
Reference in New Issue
Block a user