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