forked from qt-creator/qt-creator
HostOsInfo: Add some more useful abstractions.
Namely: - path list separator - executable suffix - file name case sensitivity All of these are duplicated in various places in the current Creator code. Change-Id: I86eb4662fa3c2071759bd728cae1aaf7111ae686 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
@@ -62,11 +62,6 @@ Q_GLOBAL_STATIC(SystemEnvironment, staticSystemEnvironment)
|
||||
|
||||
namespace Utils {
|
||||
|
||||
static QChar varSeparator()
|
||||
{
|
||||
return HostOsInfo::isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
|
||||
}
|
||||
|
||||
static bool sortEnvironmentItem(const EnvironmentItem &a, const EnvironmentItem &b)
|
||||
{
|
||||
return a.name < b.name;
|
||||
@@ -172,12 +167,14 @@ void Environment::prependOrSet(const QString&key, const QString &value, const QS
|
||||
|
||||
void Environment::appendOrSetPath(const QString &value)
|
||||
{
|
||||
appendOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value), QString(varSeparator()));
|
||||
appendOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value),
|
||||
QString(HostOsInfo::pathListSeparator()));
|
||||
}
|
||||
|
||||
void Environment::prependOrSetPath(const QString &value)
|
||||
{
|
||||
prependOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value), QString(varSeparator()));
|
||||
prependOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value),
|
||||
QString(HostOsInfo::pathListSeparator()));
|
||||
}
|
||||
|
||||
void Environment::prependOrSetLibrarySearchPath(const QString &value)
|
||||
@@ -271,7 +268,8 @@ QString Environment::searchInPath(const QStringList &executables,
|
||||
|
||||
QStringList Environment::path() const
|
||||
{
|
||||
return m_values.value(QLatin1String("PATH")).split(varSeparator(), QString::SkipEmptyParts);
|
||||
return m_values.value(QLatin1String("PATH")).split(HostOsInfo::pathListSeparator(),
|
||||
QString::SkipEmptyParts);
|
||||
}
|
||||
|
||||
QString Environment::value(const QString &key) const
|
||||
|
@@ -413,9 +413,6 @@ TempFileSaver::~TempFileSaver()
|
||||
On windows filenames are compared case insensitively.
|
||||
*/
|
||||
|
||||
const Qt::CaseSensitivity FileName::cs
|
||||
= HostOsInfo::isWindowsHost() ? Qt::CaseInsensitive : Qt::CaseSensitive;
|
||||
|
||||
FileName::FileName()
|
||||
: QString()
|
||||
{
|
||||
@@ -492,7 +489,7 @@ FileName::FileName(const QString &string)
|
||||
|
||||
bool FileName::operator==(const FileName &other) const
|
||||
{
|
||||
return QString::compare(*this, other, cs) == 0;
|
||||
return QString::compare(*this, other, HostOsInfo::fileNameCaseSensitivity()) == 0;
|
||||
}
|
||||
|
||||
bool FileName::operator!=(const FileName &other) const
|
||||
@@ -502,12 +499,12 @@ bool FileName::operator!=(const FileName &other) const
|
||||
|
||||
bool FileName::operator<(const FileName &other) const
|
||||
{
|
||||
return QString::compare(*this, other, cs) < 0;
|
||||
return QString::compare(*this, other, HostOsInfo::fileNameCaseSensitivity()) < 0;
|
||||
}
|
||||
|
||||
bool FileName::operator<=(const FileName &other) const
|
||||
{
|
||||
return QString::compare(*this, other, cs) <= 0;
|
||||
return QString::compare(*this, other, HostOsInfo::fileNameCaseSensitivity()) <= 0;
|
||||
}
|
||||
|
||||
bool FileName::operator>(const FileName &other) const
|
||||
@@ -523,7 +520,7 @@ bool FileName::operator>=(const FileName &other) const
|
||||
/// \returns whether FileName is a child of \a s
|
||||
bool FileName::isChildOf(const FileName &s) const
|
||||
{
|
||||
if (!QString::startsWith(s, cs))
|
||||
if (!QString::startsWith(s, HostOsInfo::fileNameCaseSensitivity()))
|
||||
return false;
|
||||
if (size() <= s.size())
|
||||
return false;
|
||||
@@ -539,7 +536,7 @@ bool FileName::isChildOf(const QDir &dir) const
|
||||
/// \returns whether FileName endsWith \a s
|
||||
bool FileName::endsWith(const QString &s) const
|
||||
{
|
||||
return QString::endsWith(s, cs);
|
||||
return QString::endsWith(s, HostOsInfo::fileNameCaseSensitivity());
|
||||
}
|
||||
|
||||
/// \returns the relativeChildPath of FileName to parent if FileName is a child of parent
|
||||
|
@@ -175,7 +175,6 @@ public:
|
||||
using QString::isNull;
|
||||
using QString::clear;
|
||||
private:
|
||||
static const Qt::CaseSensitivity cs;
|
||||
FileName(const QString &string);
|
||||
};
|
||||
|
||||
|
@@ -32,6 +32,14 @@
|
||||
|
||||
#include "utils_global.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#define QTC_HOST_EXE_SUFFIX ".exe"
|
||||
#else
|
||||
#define QTC_HOST_EXE_SUFFIX ""
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
namespace Utils {
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT HostOsInfo
|
||||
@@ -46,6 +54,24 @@ public:
|
||||
static bool isLinuxHost() { return hostOs() == HostOsLinux; }
|
||||
static bool isMacHost() { return hostOs() == HostOsMac; }
|
||||
static inline bool isAnyUnixHost();
|
||||
|
||||
static QString appendExecutableSuffix(const QString &executable)
|
||||
{
|
||||
QString finalName = executable;
|
||||
if (isWindowsHost())
|
||||
finalName += QLatin1String(QTC_HOST_EXE_SUFFIX);
|
||||
return finalName;
|
||||
}
|
||||
|
||||
static Qt::CaseSensitivity fileNameCaseSensitivity()
|
||||
{
|
||||
return isWindowsHost() ? Qt::CaseInsensitive: Qt::CaseSensitive;
|
||||
}
|
||||
|
||||
static QChar pathListSeparator()
|
||||
{
|
||||
return isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
|
||||
}
|
||||
};
|
||||
|
||||
HostOsInfo::HostOs HostOsInfo::hostOs()
|
||||
|
@@ -94,7 +94,7 @@ void PathListPlainTextEdit::insertFromMimeData(const QMimeData *source)
|
||||
if (source->hasText()) {
|
||||
// replace separator
|
||||
QString text = source->text().trimmed();
|
||||
text.replace(PathListEditor::separator(), QLatin1Char('\n'));
|
||||
text.replace(HostOsInfo::pathListSeparator(), QLatin1Char('\n'));
|
||||
QSharedPointer<QMimeData> fixed(new QMimeData);
|
||||
fixed->setText(text);
|
||||
QPlainTextEdit::insertFromMimeData(fixed.data());
|
||||
@@ -190,7 +190,7 @@ int PathListEditor::lastAddActionIndex()
|
||||
|
||||
QString PathListEditor::pathListString() const
|
||||
{
|
||||
return pathList().join(separator());
|
||||
return pathList().join(HostOsInfo::pathListSeparator());
|
||||
}
|
||||
|
||||
QStringList PathListEditor::pathList() const
|
||||
@@ -216,7 +216,8 @@ void PathListEditor::setPathList(const QString &pathString)
|
||||
if (pathString.isEmpty()) {
|
||||
clear();
|
||||
} else {
|
||||
setPathList(pathString.split(separator(), QString::SkipEmptyParts));
|
||||
setPathList(pathString.split(HostOsInfo::pathListSeparator(),
|
||||
QString::SkipEmptyParts));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,11 +255,6 @@ void PathListEditor::slotInsert()
|
||||
insertPathAtCursor(QDir::toNativeSeparators(dir));
|
||||
}
|
||||
|
||||
QChar PathListEditor::separator()
|
||||
{
|
||||
return HostOsInfo::isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
|
||||
}
|
||||
|
||||
// Add a button "Import from 'Path'"
|
||||
void PathListEditor::addEnvVariableImportAction(const QString &var)
|
||||
{
|
||||
|
@@ -54,8 +54,6 @@ public:
|
||||
QStringList pathList() const;
|
||||
QString fileDialogTitle() const;
|
||||
|
||||
static QChar separator();
|
||||
|
||||
// Add a convenience action "Import from 'Path'" (environment variable)
|
||||
void addEnvVariableImportAction(const QString &var);
|
||||
|
||||
|
@@ -665,7 +665,7 @@ QString SynchronousProcess::locateBinary(const QString &path, const QString &bin
|
||||
return currentDirBinary;
|
||||
}
|
||||
|
||||
const QStringList paths = path.split(pathSeparator());
|
||||
const QStringList paths = path.split(HostOsInfo::pathListSeparator());
|
||||
if (paths.empty())
|
||||
return QString();
|
||||
const QStringList::const_iterator cend = paths.constEnd();
|
||||
@@ -684,9 +684,4 @@ QString SynchronousProcess::locateBinary(const QString &binary)
|
||||
return locateBinary(QString::fromLocal8Bit(path), binary);
|
||||
}
|
||||
|
||||
QChar SynchronousProcess::pathSeparator()
|
||||
{
|
||||
return HostOsInfo::isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
|
@@ -140,7 +140,6 @@ public:
|
||||
// and file types.
|
||||
static QString locateBinary(const QString &binary);
|
||||
static QString locateBinary(const QString &path, const QString &binary);
|
||||
static QChar pathSeparator();
|
||||
|
||||
signals:
|
||||
void stdOut(const QByteArray &data, bool firstTime);
|
||||
|
@@ -264,7 +264,7 @@ QStringList AndroidConfigurations::ndkToolchainVersions() const
|
||||
FileName AndroidConfigurations::adbToolPath() const
|
||||
{
|
||||
FileName path = m_config.sdkLocation;
|
||||
return path.appendPath(QLatin1String("platform-tools/adb" ANDROID_EXE_SUFFIX));
|
||||
return path.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
FileName AndroidConfigurations::androidToolPath() const
|
||||
@@ -273,7 +273,7 @@ FileName AndroidConfigurations::androidToolPath() const
|
||||
// I want to switch from using android.bat to using an executable. All it really does is call
|
||||
// Java and I've made some progress on it. So if android.exe exists, return that instead.
|
||||
FileName path = m_config.sdkLocation;
|
||||
path.appendPath(QLatin1String("tools/android" ANDROID_EXE_SUFFIX));
|
||||
path.appendPath(QLatin1String("tools/android" QTC_HOST_EXE_SUFFIX));
|
||||
if (path.toFileInfo().exists())
|
||||
return path;
|
||||
path = m_config.sdkLocation;
|
||||
@@ -295,7 +295,7 @@ FileName AndroidConfigurations::antToolPath() const
|
||||
FileName AndroidConfigurations::emulatorToolPath() const
|
||||
{
|
||||
FileName path = m_config.sdkLocation;
|
||||
return path.appendPath(QLatin1String("tools/emulator" ANDROID_EXE_SUFFIX));
|
||||
return path.appendPath(QLatin1String("tools/emulator" QTC_HOST_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
FileName AndroidConfigurations::toolPath(Abi::Architecture architecture) const
|
||||
@@ -310,17 +310,17 @@ FileName AndroidConfigurations::toolPath(Abi::Architecture architecture) const
|
||||
|
||||
FileName AndroidConfigurations::stripPath(Abi::Architecture architecture) const
|
||||
{
|
||||
return toolPath(architecture).append(QLatin1String("-strip" ANDROID_EXE_SUFFIX));
|
||||
return toolPath(architecture).append(QLatin1String("-strip" QTC_HOST_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
FileName AndroidConfigurations::readelfPath(Abi::Architecture architecture) const
|
||||
{
|
||||
return toolPath(architecture).append(QLatin1String("-readelf" ANDROID_EXE_SUFFIX));
|
||||
return toolPath(architecture).append(QLatin1String("-readelf" QTC_HOST_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
FileName AndroidConfigurations::gccPath(Abi::Architecture architecture) const
|
||||
{
|
||||
return toolPath(architecture).append(QLatin1String("-gcc" ANDROID_EXE_SUFFIX));
|
||||
return toolPath(architecture).append(QLatin1String("-gcc" QTC_HOST_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
FileName AndroidConfigurations::gdbServerPath(Abi::Architecture architecture) const
|
||||
@@ -362,7 +362,7 @@ FileName AndroidConfigurations::gdbPath(Abi::Architecture architecture) const
|
||||
}
|
||||
if (!gdbPath.isEmpty())
|
||||
return gdbPath;
|
||||
return toolPath(architecture).append(QLatin1String("-gdb" ANDROID_EXE_SUFFIX));
|
||||
return toolPath(architecture).append(QLatin1String("-gdb" QTC_HOST_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
FileName AndroidConfigurations::openJDKPath() const
|
||||
@@ -391,7 +391,7 @@ FileName AndroidConfigurations::jarsignerPath() const
|
||||
FileName AndroidConfigurations::zipalignPath() const
|
||||
{
|
||||
Utils::FileName path = m_config.sdkLocation;
|
||||
return path.appendPath(QLatin1String("tools/zipalign" ANDROID_EXE_SUFFIX));
|
||||
return path.appendPath(QLatin1String("tools/zipalign" QTC_HOST_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::getDeployDeviceSerialNumber(int *apiLevel) const
|
||||
|
@@ -45,10 +45,8 @@ enum AndroidQemuStatus {
|
||||
};
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
#define ANDROID_EXE_SUFFIX ".exe"
|
||||
#define ANDROID_BAT_SUFFIX ".bat"
|
||||
#else
|
||||
#define ANDROID_EXE_SUFFIX ""
|
||||
#define ANDROID_BAT_SUFFIX ""
|
||||
#endif
|
||||
|
||||
|
@@ -190,10 +190,10 @@ bool AndroidSettingsWidget::checkSDK(const Utils::FileName &location)
|
||||
Utils::FileName androidExe = location;
|
||||
Utils::FileName androidBat = location;
|
||||
Utils::FileName emulator = location;
|
||||
if (!adb.appendPath(QLatin1String("platform-tools/adb" ANDROID_EXE_SUFFIX)).toFileInfo().exists()
|
||||
|| (!androidExe.appendPath(QLatin1String("/tools/android" ANDROID_EXE_SUFFIX)).toFileInfo().exists()
|
||||
if (!adb.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()
|
||||
|| (!androidExe.appendPath(QLatin1String("/tools/android" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()
|
||||
&& !androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).toFileInfo().exists())
|
||||
|| !emulator.appendPath(QLatin1String("/tools/emulator" ANDROID_EXE_SUFFIX)).toFileInfo().exists()) {
|
||||
|| !emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()) {
|
||||
QMessageBox::critical(this, tr("Android SDK Folder"), tr("\"%1\" doesn't seem to be an Android SDK top folder").arg(location.toUserOutput()));
|
||||
return false;
|
||||
}
|
||||
|
@@ -58,10 +58,7 @@ enum { defaultTimeOutS = 30, defaultHistoryCount = 50 };
|
||||
|
||||
static QString defaultCommand()
|
||||
{
|
||||
QString rc(QLatin1String("cleartool"));
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
rc.append(QLatin1String(".exe"));
|
||||
return rc;
|
||||
return QLatin1String("cleartool" QTC_HOST_EXE_SUFFIX);
|
||||
}
|
||||
|
||||
using namespace ClearCase::Internal;
|
||||
|
@@ -49,11 +49,7 @@ enum { defaultTimeOutS = 30 };
|
||||
|
||||
static QString defaultCommand()
|
||||
{
|
||||
QString rc;
|
||||
rc = QLatin1String("cvs");
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
rc.append(QLatin1String(".exe"));
|
||||
return rc;
|
||||
return QLatin1String("cvs" QTC_HOST_EXE_SUFFIX);
|
||||
}
|
||||
|
||||
namespace Cvs {
|
||||
|
@@ -4982,15 +4982,17 @@ void GdbEngine::finishInferiorSetup()
|
||||
|
||||
void GdbEngine::handleDebugInfoLocation(const GdbResponse &response)
|
||||
{
|
||||
const char pathSep = HostOsInfo::isWindowsHost() ? ';' : ':';
|
||||
if (response.resultClass == GdbResultDone) {
|
||||
const QByteArray debugInfoLocation = startParameters().debugInfoLocation.toLocal8Bit();
|
||||
if (QFile::exists(QString::fromLocal8Bit(debugInfoLocation))) {
|
||||
const QByteArray curDebugInfoLocations = response.consoleStreamOutput.split('"').value(1);
|
||||
if (curDebugInfoLocations.isEmpty())
|
||||
if (curDebugInfoLocations.isEmpty()) {
|
||||
postCommand("set debug-file-directory " + debugInfoLocation);
|
||||
else
|
||||
postCommand("set debug-file-directory " + debugInfoLocation + pathSep + curDebugInfoLocations);
|
||||
} else {
|
||||
postCommand("set debug-file-directory " + debugInfoLocation
|
||||
+ HostOsInfo::pathListSeparator().toLatin1()
|
||||
+ curDebugInfoLocations);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include "gdbengine.h"
|
||||
#include "gdbmi.h"
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/fancymainwindow.h>
|
||||
#include <projectexplorer/abi.h>
|
||||
@@ -157,11 +158,6 @@ void GdbRemoteServerEngine::setupInferior()
|
||||
{
|
||||
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
||||
const DebuggerStartParameters &sp = startParameters();
|
||||
#ifdef Q_OS_WIN
|
||||
#define PATHSEP ";"
|
||||
#else
|
||||
#define PATHSEP ":"
|
||||
#endif
|
||||
QString executableFileName;
|
||||
if (!sp.executable.isEmpty()) {
|
||||
QFileInfo fi(sp.executable);
|
||||
@@ -179,7 +175,8 @@ void GdbRemoteServerEngine::setupInferior()
|
||||
|
||||
// if (!remoteArch.isEmpty())
|
||||
// postCommand("set architecture " + remoteArch);
|
||||
const QString solibSearchPath = sp.solibSearchPath.join(QLatin1String(PATHSEP));
|
||||
const QString solibSearchPath
|
||||
= sp.solibSearchPath.join(QString(Utils::HostOsInfo::pathListSeparator()));
|
||||
if (!solibSearchPath.isEmpty())
|
||||
postCommand("set solib-search-path " + solibSearchPath.toLocal8Bit());
|
||||
|
||||
|
@@ -1445,7 +1445,7 @@ QProcessEnvironment GitClient::processEnvironment() const
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString gitPath = settings()->stringValue(GitSettings::pathKey);
|
||||
if (!gitPath.isEmpty()) {
|
||||
gitPath += Utils::SynchronousProcess::pathSeparator();
|
||||
gitPath += Utils::HostOsInfo::pathListSeparator();
|
||||
gitPath += environment.value(QLatin1String("PATH"));
|
||||
environment.insert(QLatin1String("PATH"), gitPath);
|
||||
}
|
||||
|
@@ -84,7 +84,7 @@ QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const
|
||||
QString systemPath = QString::fromLocal8Bit(qgetenv("PATH"));
|
||||
if (!systemPath.isEmpty()) {
|
||||
if (!currentPath.isEmpty())
|
||||
currentPath.append(Utils::SynchronousProcess::pathSeparator());
|
||||
currentPath.append(Utils::HostOsInfo::pathListSeparator());
|
||||
currentPath.append(systemPath);
|
||||
}
|
||||
// Search in path?
|
||||
|
@@ -40,12 +40,6 @@ const char HarmattanOsType[] = "HarmattanOsType";
|
||||
|
||||
#define PREFIX "Qt4ProjectManager.MaemoRunConfiguration"
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
#define EXEC_SUFFIX ".exe"
|
||||
#else
|
||||
#define EXEC_SUFFIX ""
|
||||
#endif
|
||||
|
||||
static const char MAEMO_RC_ID_PREFIX[] = PREFIX ":";
|
||||
|
||||
static const QLatin1String LastDeployedHostsKey(PREFIX ".LastDeployedHosts");
|
||||
|
@@ -56,9 +56,7 @@ using namespace Utils;
|
||||
|
||||
namespace Madde {
|
||||
namespace Internal {
|
||||
namespace {
|
||||
static const QLatin1String binQmake("/bin/qmake" EXEC_SUFFIX);
|
||||
} // namespace
|
||||
static const QString binQmake = QLatin1String("/bin/qmake" QTC_HOST_EXE_SUFFIX);
|
||||
|
||||
bool MaemoGlobal::hasMaemoDevice(const Kit *k)
|
||||
{
|
||||
@@ -176,9 +174,7 @@ FileName MaemoGlobal::maddeRoot(const Kit *k)
|
||||
|
||||
QString MaemoGlobal::targetRoot(const QString &qmakePath)
|
||||
{
|
||||
const Qt::CaseSensitivity cs = HostOsInfo::isWindowsHost()
|
||||
? Qt::CaseInsensitive : Qt::CaseSensitive;
|
||||
return QDir::cleanPath(qmakePath).remove(binQmake, cs);
|
||||
return QDir::cleanPath(qmakePath).remove(binQmake, HostOsInfo::fileNameCaseSensitivity());
|
||||
}
|
||||
|
||||
QString MaemoGlobal::targetName(const QString &qmakePath)
|
||||
|
@@ -58,10 +58,7 @@ enum { defaultTimeOutS = 30, defaultLogCount = 1000 };
|
||||
|
||||
static QString defaultCommand()
|
||||
{
|
||||
QString rc = QLatin1String("p4");
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
rc.append(QLatin1String(".exe"));
|
||||
return rc;
|
||||
return QLatin1String("p4" QTC_HOST_EXE_SUFFIX);
|
||||
}
|
||||
|
||||
namespace Perforce {
|
||||
|
@@ -2543,16 +2543,8 @@ void Version11Handler::addRunConfigurations(Kit *k,
|
||||
|
||||
static QString targetRoot(const QString &qmakePath)
|
||||
{
|
||||
Qt::CaseSensitivity cs;
|
||||
QString binQmake;
|
||||
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||
cs = Qt::CaseInsensitive;
|
||||
binQmake = "/bin/qmake.exe";
|
||||
} else {
|
||||
cs = Qt::CaseSensitive;
|
||||
binQmake = "/bin/qmake";
|
||||
}
|
||||
return QDir::cleanPath(qmakePath).remove(binQmake, cs);
|
||||
return QDir::cleanPath(qmakePath).remove(QLatin1String("/bin/qmake" QTC_HOST_EXE_SUFFIX),
|
||||
Utils::HostOsInfo::fileNameCaseSensitivity());
|
||||
}
|
||||
|
||||
static QString maddeRoot(const QString &qmakePath)
|
||||
|
@@ -444,16 +444,9 @@ void NodeInstanceServerProxy::readThirdDataStream()
|
||||
|
||||
QString NodeInstanceServerProxy::qmlPuppetApplicationName() const
|
||||
{
|
||||
QString appName;
|
||||
if (hasQtQuick2(m_nodeInstanceView.data())) {
|
||||
appName = QLatin1String("qml2puppet");
|
||||
} else {
|
||||
appName = QLatin1String("qmlpuppet");
|
||||
}
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
appName += QLatin1String(".exe");
|
||||
|
||||
return appName;
|
||||
if (hasQtQuick2(m_nodeInstanceView.data()))
|
||||
return QLatin1String("qml2puppet" QTC_HOST_EXE_SUFFIX);
|
||||
return QLatin1String("qmlpuppet" QTC_HOST_EXE_SUFFIX);
|
||||
}
|
||||
|
||||
QString NodeInstanceServerProxy::macOSBundlePath(const QString &path) const
|
||||
|
@@ -58,8 +58,8 @@ static inline QStringList importPaths() {
|
||||
// env import paths
|
||||
QByteArray envImportPath = qgetenv("QML_IMPORT_PATH");
|
||||
if (!envImportPath.isEmpty()) {
|
||||
const QChar sep = Utils::HostOsInfo::isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
|
||||
paths = QString::fromLatin1(envImportPath).split(sep, QString::SkipEmptyParts);
|
||||
paths = QString::fromLatin1(envImportPath)
|
||||
.split(Utils::HostOsInfo::pathListSeparator(), QString::SkipEmptyParts);
|
||||
}
|
||||
|
||||
return paths;
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "qmljspreviewrunner.h"
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/synchronousprocess.h>
|
||||
|
||||
@@ -47,7 +48,7 @@ QmlJSPreviewRunner::QmlJSPreviewRunner(QObject *parent) :
|
||||
{
|
||||
// prepend creator/bin dir to search path (only useful for special creator-qml package)
|
||||
const QString searchPath = QCoreApplication::applicationDirPath()
|
||||
+ Utils::SynchronousProcess::pathSeparator()
|
||||
+ Utils::HostOsInfo::pathListSeparator()
|
||||
+ QString(qgetenv("PATH"));
|
||||
m_qmlViewerDefaultPath = Utils::SynchronousProcess::locateBinary(searchPath, QLatin1String("qmlviewer"));
|
||||
|
||||
|
@@ -655,8 +655,8 @@ static QStringList environmentImportPaths()
|
||||
|
||||
QByteArray envImportPath = qgetenv("QML_IMPORT_PATH");
|
||||
|
||||
const QChar pathSep = Utils::HostOsInfo::isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
|
||||
foreach (const QString &path, QString::fromLatin1(envImportPath).split(pathSep, QString::SkipEmptyParts)) {
|
||||
foreach (const QString &path, QString::fromLatin1(envImportPath)
|
||||
.split(Utils::HostOsInfo::pathListSeparator(), QString::SkipEmptyParts)) {
|
||||
QString canonicalPath = QDir(path).canonicalPath();
|
||||
if (!canonicalPath.isEmpty() && !paths.contains(canonicalPath))
|
||||
paths.append(canonicalPath);
|
||||
|
@@ -73,8 +73,8 @@ QMultiMap<QString, QString> parseEnvironmentFile(const QString &fileName)
|
||||
QMapIterator<QString, QString> it(fileContent);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
const QChar sep = Utils::HostOsInfo::isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
|
||||
const QStringList values = it.value().split(sep);
|
||||
const QStringList values
|
||||
= it.value().split(Utils::HostOsInfo::pathListSeparator());
|
||||
QString key = it.key();
|
||||
foreach (const QString &value, values) {
|
||||
const QString ownKeyAsWindowsVar = QLatin1Char('%') + key + QLatin1Char('%');
|
||||
|
@@ -2270,8 +2270,7 @@ TargetInformation Qt4ProFileNode::targetInformation(QtSupport::ProFileReader *re
|
||||
result.executable = QDir::cleanPath(wd + QLatin1Char('/') + result.target);
|
||||
//qDebug() << "##### updateTarget sets:" << result.workingDir << result.executable;
|
||||
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
result.executable += QLatin1String(".exe");
|
||||
Utils::HostOsInfo::appendExecutableSuffix(result.executable);
|
||||
result.valid = true;
|
||||
return result;
|
||||
}
|
||||
|
@@ -50,10 +50,7 @@ enum { defaultTimeOutS = 30, defaultLogCount = 1000 };
|
||||
|
||||
static QString defaultCommand()
|
||||
{
|
||||
QString rc = QLatin1String("svn");
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
rc.append(QLatin1String(".exe"));
|
||||
return rc;
|
||||
return QLatin1String("svn" QTC_HOST_EXE_SUFFIX);
|
||||
}
|
||||
|
||||
using namespace Subversion::Internal;
|
||||
|
Reference in New Issue
Block a user