diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2014-07-15 23:32:11 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2014-07-16 12:44:01 +0200 |
commit | 71b56d2b9c3264bd481915c763aac685c1ad24d0 (patch) | |
tree | 3f3281d75d0d888e822ad107c70fed3367b3befb /src | |
parent | f8dfa03d4f3a40990b3461f64ac0a5d479fab7d8 (diff) | |
download | qt-creator-71b56d2b9c3264bd481915c763aac685c1ad24d0.tar.gz |
Some QString -> FileName transformation
Change-Id: I4a8a8f68bb1e52750380218793ec3029b488c01f
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Diffstat (limited to 'src')
62 files changed, 237 insertions, 195 deletions
diff --git a/src/libs/utils/buildablehelperlibrary.cpp b/src/libs/utils/buildablehelperlibrary.cpp index 967ef75fe9..1cce9ffb1b 100644 --- a/src/libs/utils/buildablehelperlibrary.cpp +++ b/src/libs/utils/buildablehelperlibrary.cpp @@ -182,13 +182,13 @@ bool BuildableHelperLibrary::copyFiles(const QString &sourcePath, // Helper: Run a build process with merged stdout/stderr static inline bool runBuildProcessI(QProcess &proc, - const QString &binary, + const FileName &binary, const QStringList &args, int timeoutMS, bool ignoreNonNullExitCode, QString *output, QString *errorMessage) { - proc.start(binary, args); + proc.start(binary.toString(), args); if (!proc.waitForStarted()) { *errorMessage = QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary", "Cannot start process: %1"). @@ -223,7 +223,7 @@ static inline bool runBuildProcessI(QProcess &proc, // Run a build process with merged stdout/stderr and qWarn about errors. static bool runBuildProcess(QProcess &proc, - const QString &binary, + const FileName &binary, const QStringList &args, int timeoutMS, bool ignoreNonNullExitCode, @@ -232,7 +232,7 @@ static bool runBuildProcess(QProcess &proc, const bool rc = runBuildProcessI(proc, binary, args, timeoutMS, ignoreNonNullExitCode, output, errorMessage); if (!rc) { // Fail - reformat error. - QString cmd = binary; + QString cmd = binary.toString(); if (!args.isEmpty()) { cmd += QLatin1Char(' '); cmd += args.join(QString(QLatin1Char(' '))); @@ -262,7 +262,7 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments, arguments.directory)); log->append(newline); - const QString makeFullPath = arguments.environment.searchInPath(arguments.makeCommand); + const FileName makeFullPath = arguments.environment.searchInPath(arguments.makeCommand); if (QFileInfo(arguments.directory + QLatin1String("/Makefile")).exists()) { if (makeFullPath.isEmpty()) { *errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary", @@ -271,7 +271,8 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments, } const QString cleanTarget = QLatin1String("distclean"); log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary", - "Running %1 %2...\n").arg(makeFullPath, cleanTarget)); + "Running %1 %2...\n") + .arg(makeFullPath.toUserOutput(), cleanTarget)); if (!runBuildProcess(proc, makeFullPath, QStringList(cleanTarget), 30000, true, log, errorMessage)) return false; } @@ -288,7 +289,7 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments, "Running %1 %2 ...\n").arg(arguments.qmakeCommand.toUserOutput(), qmakeArgs.join(QLatin1String(" ")))); - if (!runBuildProcess(proc, arguments.qmakeCommand.toString(), qmakeArgs, 30000, false, log, errorMessage)) + if (!runBuildProcess(proc, arguments.qmakeCommand, qmakeArgs, 30000, false, log, errorMessage)) return false; log->append(newline); if (makeFullPath.isEmpty()) { @@ -297,7 +298,8 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments, return false; } log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary", - "Running %1 %2 ...\n").arg(makeFullPath, arguments.makeArguments.join(QLatin1String(" ")))); + "Running %1 %2 ...\n") + .arg(makeFullPath.toUserOutput(), arguments.makeArguments.join(QLatin1String(" ")))); if (!runBuildProcess(proc, makeFullPath, arguments.makeArguments, 120000, false, log, errorMessage)) return false; return true; diff --git a/src/libs/utils/consoleprocess_unix.cpp b/src/libs/utils/consoleprocess_unix.cpp index 68917967dc..9c55d970cc 100644 --- a/src/libs/utils/consoleprocess_unix.cpp +++ b/src/libs/utils/consoleprocess_unix.cpp @@ -372,7 +372,7 @@ QString ConsoleProcess::defaultTerminalEmulator() const Environment env = Environment::systemEnvironment(); const int terminalCount = int(sizeof(knownTerminals) / sizeof(knownTerminals[0])); for (int i = 0; i < terminalCount; ++i) { - QString result = env.searchInPath(QLatin1String(knownTerminals[i].binary)); + QString result = env.searchInPath(QLatin1String(knownTerminals[i].binary)).toString(); if (!result.isEmpty()) { result += QLatin1Char(' '); result += QLatin1String(knownTerminals[i].options); @@ -388,7 +388,7 @@ QStringList ConsoleProcess::availableTerminalEmulators() const Environment env = Environment::systemEnvironment(); const int terminalCount = int(sizeof(knownTerminals) / sizeof(knownTerminals[0])); for (int i = 0; i < terminalCount; ++i) { - QString terminal = env.searchInPath(QLatin1String(knownTerminals[i].binary)); + QString terminal = env.searchInPath(QLatin1String(knownTerminals[i].binary)).toString(); if (!terminal.isEmpty()) { terminal += QLatin1Char(' '); terminal += QLatin1String(knownTerminals[i].options); diff --git a/src/libs/utils/environment.cpp b/src/libs/utils/environment.cpp index 30d69e60d1..ba3ed30b45 100644 --- a/src/libs/utils/environment.cpp +++ b/src/libs/utils/environment.cpp @@ -214,11 +214,11 @@ void Environment::clear() m_values.clear(); } -QString Environment::searchInDirectory(const QStringList &execs, QString directory) const +FileName Environment::searchInDirectory(const QStringList &execs, QString directory) const { const QChar slash = QLatin1Char('/'); if (directory.isEmpty()) - return QString(); + return FileName(); // Avoid turing / into // on windows which triggers windows to check // for network drives! if (!directory.endsWith(slash)) @@ -227,16 +227,16 @@ QString Environment::searchInDirectory(const QStringList &execs, QString directo foreach (const QString &exec, execs) { QFileInfo fi(directory + exec); if (fi.exists() && fi.isFile() && fi.isExecutable()) - return fi.absoluteFilePath(); + return FileName::fromString(fi.absoluteFilePath()); } - return QString(); + return FileName(); } -QString Environment::searchInPath(const QString &executable, - const QStringList &additionalDirs) const +FileName Environment::searchInPath(const QString &executable, + const QStringList &additionalDirs) const { if (executable.isEmpty()) - return QString(); + return FileName(); QString exec = QDir::cleanPath(expandVariables(executable)); QFileInfo fi(exec); @@ -252,7 +252,7 @@ QString Environment::searchInPath(const QString &executable, QString tmp = executable + ext.toLower(); if (fi.isAbsolute()) { if (QFile::exists(tmp)) - return tmp; + return FileName::fromString(tmp); } else { execs << tmp; } @@ -261,30 +261,30 @@ QString Environment::searchInPath(const QString &executable, } if (fi.isAbsolute()) - return exec; + return FileName::fromString(exec); QSet<QString> alreadyChecked; foreach (const QString &dir, additionalDirs) { if (alreadyChecked.contains(dir)) continue; alreadyChecked.insert(dir); - QString tmp = searchInDirectory(execs, dir); + FileName tmp = searchInDirectory(execs, dir); if (!tmp.isEmpty()) return tmp; } if (executable.indexOf(QLatin1Char('/')) != -1) - return QString(); + return FileName(); foreach (const QString &p, path()) { if (alreadyChecked.contains(p)) continue; alreadyChecked.insert(p); - QString tmp = searchInDirectory(execs, QDir::fromNativeSeparators(p)); + FileName tmp = searchInDirectory(execs, QDir::fromNativeSeparators(p)); if (!tmp.isEmpty()) return tmp; } - return QString(); + return FileName(); } QStringList Environment::path() const diff --git a/src/libs/utils/environment.h b/src/libs/utils/environment.h index 8527e55eda..300d8cea53 100644 --- a/src/libs/utils/environment.h +++ b/src/libs/utils/environment.h @@ -30,6 +30,7 @@ #ifndef UTILS_ENVIRONMENT_H #define UTILS_ENVIRONMENT_H +#include "fileutils.h" #include "hostosinfo.h" #include "utils_global.h" @@ -100,8 +101,8 @@ public: Environment::const_iterator constEnd() const; Environment::const_iterator constFind(const QString &name) const; - QString searchInPath(const QString &executable, - const QStringList &additionalDirs = QStringList()) const; + FileName searchInPath(const QString &executable, + const QStringList &additionalDirs = QStringList()) const; QStringList path() const; QString expandVariables(const QString &input) const; @@ -111,7 +112,7 @@ public: bool operator==(const Environment &other) const; private: - QString searchInDirectory(const QStringList &execs, QString directory) const; + FileName searchInDirectory(const QStringList &execs, QString directory) const; QMap<QString, QString> m_values; OsType m_osType; }; diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index e13c5855d6..4580a18c3f 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -211,8 +211,8 @@ QString PathChooserPrivate::expandedPath(const QString &input) const switch (m_acceptingKind) { case PathChooser::Command: case PathChooser::ExistingCommand: { - const QString expanded = m_environment.searchInPath(path, QStringList(m_baseDirectory)); - return expanded.isEmpty() ? path : expanded; + const FileName expanded = m_environment.searchInPath(path, QStringList(m_baseDirectory)); + return expanded.isEmpty() ? path : expanded.toString(); } case PathChooser::Any: break; diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index b2021b34a1..a66c351be0 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -1188,22 +1188,22 @@ AndroidConfigurations::AndroidConfigurations(QObject *parent) m_instance = this; } -Utils::FileName javaHomeForJavac(const QString &location) +static FileName javaHomeForJavac(const FileName &location) { - QFileInfo fileInfo(location); + QFileInfo fileInfo = location.toFileInfo(); int tries = 5; while (tries > 0) { QDir dir = fileInfo.dir(); dir.cdUp(); if (QFileInfo(dir.filePath(QLatin1String("lib/tools.jar"))).exists()) - return Utils::FileName::fromString(dir.path()); + return FileName::fromString(dir.path()); if (fileInfo.isSymLink()) fileInfo.setFile(fileInfo.symLinkTarget()); else break; --tries; } - return Utils::FileName(); + return FileName(); } void AndroidConfigurations::load() @@ -1215,10 +1215,10 @@ void AndroidConfigurations::load() if (m_config.antLocation().isEmpty()) { Environment env = Environment::systemEnvironment(); - QString location = env.searchInPath(QLatin1String("ant")); - QFileInfo fi(location); + FileName location = env.searchInPath(QLatin1String("ant")); + QFileInfo fi = location.toFileInfo(); if (fi.exists() && fi.isExecutable() && !fi.isDir()) { - m_config.setAntLocation(FileName::fromString(location)); + m_config.setAntLocation(location); saveSettings = true; } } @@ -1226,8 +1226,8 @@ void AndroidConfigurations::load() if (m_config.openJDKLocation().isEmpty()) { if (HostOsInfo::isLinuxHost()) { Environment env = Environment::systemEnvironment(); - QString location = env.searchInPath(QLatin1String("javac")); - QFileInfo fi(location); + FileName location = env.searchInPath(QLatin1String("javac")); + QFileInfo fi = location.toFileInfo(); if (fi.exists() && fi.isExecutable() && !fi.isDir()) { m_config.setOpenJDKLocation(javaHomeForJavac(location)); saveSettings = true; diff --git a/src/plugins/android/androidtoolchain.cpp b/src/plugins/android/androidtoolchain.cpp index 1f03231231..68a8ff2f3a 100644 --- a/src/plugins/android/androidtoolchain.cpp +++ b/src/plugins/android/androidtoolchain.cpp @@ -217,16 +217,16 @@ QString AndroidToolChain::makeCommand(const Utils::Environment &env) const { QStringList extraDirectories = AndroidConfigurations::currentConfig().makeExtraSearchDirectories(); if (HostOsInfo::isWindowsHost()) { - QString tmp = env.searchInPath(QLatin1String("ma-make.exe"), extraDirectories); + FileName tmp = env.searchInPath(QLatin1String("ma-make.exe"), extraDirectories); if (!tmp.isEmpty()) - return tmp; + return QString(); tmp = env.searchInPath(QLatin1String("mingw32-make"), extraDirectories); - return tmp.isEmpty() ? QLatin1String("mingw32-make") : tmp; + return tmp.isEmpty() ? QLatin1String("mingw32-make") : tmp.toString(); } QString make = QLatin1String("make"); - QString tmp = env.searchInPath(make, extraDirectories); - return tmp.isEmpty() ? make : tmp; + FileName tmp = env.searchInPath(make, extraDirectories); + return tmp.isEmpty() ? make : tmp.toString(); } QString AndroidToolChain::ndkToolChainVersion() const diff --git a/src/plugins/bazaar/bazaarcontrol.cpp b/src/plugins/bazaar/bazaarcontrol.cpp index 56d10a9c33..7ec4520c3f 100644 --- a/src/plugins/bazaar/bazaarcontrol.cpp +++ b/src/plugins/bazaar/bazaarcontrol.cpp @@ -68,10 +68,10 @@ bool BazaarControl::managesFile(const QString &workingDirectory, const QString & bool BazaarControl::isConfigured() const { - const QString binary = m_bazaarClient->settings()->binaryPath(); + const Utils::FileName binary = m_bazaarClient->settings()->binaryPath(); if (binary.isEmpty()) return false; - QFileInfo fi(binary); + QFileInfo fi = binary.toFileInfo(); return fi.exists() && fi.isFile() && fi.isExecutable(); } diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp index 1ea29ff15a..03ffa2e3a4 100644 --- a/src/plugins/clearcase/clearcaseplugin.cpp +++ b/src/plugins/clearcase/clearcaseplugin.cpp @@ -1500,7 +1500,7 @@ ClearCaseResponse } const Utils::SynchronousProcessResponse sp_resp = - VcsBase::VcsBasePlugin::runVcs(workingDir, executable, + VcsBase::VcsBasePlugin::runVcs(workingDir, Utils::FileName::fromUserInput(executable), arguments, timeOut, flags, outputCodec); diff --git a/src/plugins/clearcase/clearcasesettings.cpp b/src/plugins/clearcase/clearcasesettings.cpp index f3e6320e90..edd144f3fd 100644 --- a/src/plugins/clearcase/clearcasesettings.cpp +++ b/src/plugins/clearcase/clearcasesettings.cpp @@ -77,7 +77,7 @@ void ClearCaseSettings::fromSettings(QSettings *settings) { settings->beginGroup(QLatin1String(groupC)); ccCommand = settings->value(QLatin1String(commandKeyC), defaultCommand()).toString(); - ccBinaryPath = Utils::Environment::systemEnvironment().searchInPath(ccCommand); + ccBinaryPath = Utils::Environment::systemEnvironment().searchInPath(ccCommand).toString(); timeOutS = settings->value(QLatin1String(timeOutKeyC), defaultTimeOutS).toInt(); autoCheckOut = settings->value(QLatin1String(autoCheckOutKeyC), false).toBool(); QString sDiffType = settings->value(QLatin1String(diffTypeKeyC), QLatin1String("Graphical")).toString(); diff --git a/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp b/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp index bc1360cdb5..c03dd394f6 100644 --- a/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp +++ b/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp @@ -81,7 +81,7 @@ CMakeSettingsPage::~CMakeSettingsPage() QString CMakeSettingsPage::findCmakeExecutable() const { - return Utils::Environment::systemEnvironment().searchInPath(QLatin1String("cmake")); + return Utils::Environment::systemEnvironment().searchInPath(QLatin1String("cmake")).toString(); } QWidget *CMakeSettingsPage::widget() diff --git a/src/plugins/coreplugin/externaltool.cpp b/src/plugins/coreplugin/externaltool.cpp index 2b37844d7f..5aa9ca232f 100644 --- a/src/plugins/coreplugin/externaltool.cpp +++ b/src/plugins/coreplugin/externaltool.cpp @@ -608,9 +608,10 @@ void ExternalToolRunner::run() connect(m_process, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError())); if (!m_resolvedWorkingDirectory.isEmpty()) m_process->setWorkingDirectory(m_resolvedWorkingDirectory); - m_process->setCommand(m_resolvedExecutable, m_resolvedArguments); - MessageManager::write( - tr("Starting external tool \"%1\" %2").arg(m_resolvedExecutable, m_resolvedArguments), MessageManager::Silent); + m_process->setCommand(m_resolvedExecutable.toString(), m_resolvedArguments); + MessageManager::write(tr("Starting external tool \"%1\" %2") + .arg(m_resolvedExecutable.toUserOutput(), m_resolvedArguments), + MessageManager::Silent); m_process->start(); } @@ -630,8 +631,8 @@ void ExternalToolRunner::finished(int exitCode, QProcess::ExitStatus status) } if (m_tool->modifiesCurrentDocument()) DocumentManager::unexpectFileChange(m_expectedFileName); - MessageManager::write( - tr("\"%1\" finished").arg(m_resolvedExecutable), MessageManager::Silent); + MessageManager::write(tr("\"%1\" finished") + .arg(m_resolvedExecutable.toUserOutput()), MessageManager::Silent); deleteLater(); } diff --git a/src/plugins/coreplugin/externaltool.h b/src/plugins/coreplugin/externaltool.h index b47b85c5a0..0729c2e499 100644 --- a/src/plugins/coreplugin/externaltool.h +++ b/src/plugins/coreplugin/externaltool.h @@ -30,6 +30,8 @@ #ifndef EXTERNALTOOL_H #define EXTERNALTOOL_H +#include <utils/fileutils.h> + #include <QObject> #include <QStringList> #include <QProcess> @@ -139,7 +141,7 @@ private: bool resolve(); const ExternalTool *m_tool; // is a copy of the tool that was passed in - QString m_resolvedExecutable; + Utils::FileName m_resolvedExecutable; QString m_resolvedArguments; QString m_resolvedInput; QString m_resolvedWorkingDirectory; diff --git a/src/plugins/coreplugin/fileutils.cpp b/src/plugins/coreplugin/fileutils.cpp index 36758de1e3..003f677434 100644 --- a/src/plugins/coreplugin/fileutils.cpp +++ b/src/plugins/coreplugin/fileutils.cpp @@ -77,7 +77,7 @@ void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn) { // Mac, Windows support folder or file. if (HostOsInfo::isWindowsHost()) { - const QString explorer = Environment::systemEnvironment().searchInPath(QLatin1String("explorer.exe")); + const FileName explorer = Environment::systemEnvironment().searchInPath(QLatin1String("explorer.exe")); if (explorer.isEmpty()) { QMessageBox::warning(parent, QApplication::translate("Core::Internal", @@ -90,7 +90,7 @@ void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn) if (!QFileInfo(pathIn).isDir()) param += QLatin1String("/select,"); param += QDir::toNativeSeparators(pathIn); - QProcess::startDetached(explorer, param); + QProcess::startDetached(explorer.toString(), param); } else if (HostOsInfo::isMacHost()) { QStringList scriptArgs; scriptArgs << QLatin1String("-e") diff --git a/src/plugins/coreplugin/locator/executefilter.cpp b/src/plugins/coreplugin/locator/executefilter.cpp index 9376d8a741..6bb51dcf0b 100644 --- a/src/plugins/coreplugin/locator/executefilter.cpp +++ b/src/plugins/coreplugin/locator/executefilter.cpp @@ -155,7 +155,7 @@ void ExecuteFilter::runHeadCommand() { if (!m_taskQueue.isEmpty()) { const ExecuteData &d = m_taskQueue.head(); - const QString fullPath = Utils::Environment::systemEnvironment().searchInPath(d.executable); + const Utils::FileName fullPath = Utils::Environment::systemEnvironment().searchInPath(d.executable); if (fullPath.isEmpty()) { MessageManager::write(tr("Could not find executable for \"%1\".").arg(d.executable)); m_taskQueue.dequeue(); @@ -164,7 +164,7 @@ void ExecuteFilter::runHeadCommand() } MessageManager::write(tr("Starting command \"%1\".").arg(headCommand())); m_process->setWorkingDirectory(d.workingDirectory); - m_process->setCommand(fullPath, d.arguments); + m_process->setCommand(fullPath.toString(), d.arguments); m_process->start(); m_process->closeWriteChannel(); if (!m_process->waitForStarted(1000)) { diff --git a/src/plugins/cvs/checkoutwizard.cpp b/src/plugins/cvs/checkoutwizard.cpp index 6c7cfca6d4..ce4b3ab4fc 100644 --- a/src/plugins/cvs/checkoutwizard.cpp +++ b/src/plugins/cvs/checkoutwizard.cpp @@ -80,7 +80,7 @@ VcsBase::Command *CheckoutWizard::createCommand(Utils::FileName *checkoutDir) QTC_ASSERT(cwp, return 0); const CvsSettings settings = CvsPlugin::instance()->settings(); - const QString binary = settings.binaryPath(); + const Utils::FileName binary = settings.binaryPath(); QStringList args; const QString repository = cwp->repository(); diff --git a/src/plugins/cvs/cvscontrol.cpp b/src/plugins/cvs/cvscontrol.cpp index af1b9c0b9d..bb62828c6d 100644 --- a/src/plugins/cvs/cvscontrol.cpp +++ b/src/plugins/cvs/cvscontrol.cpp @@ -55,10 +55,10 @@ Core::Id CvsControl::id() const bool CvsControl::isConfigured() const { - const QString binary = m_plugin->settings().binaryPath(); + const Utils::FileName binary = m_plugin->settings().binaryPath(); if (binary.isEmpty()) return false; - QFileInfo fi(binary); + QFileInfo fi = binary.toFileInfo(); return fi.exists() && fi.isFile() && fi.isExecutable(); } diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index c155c2ea79..5fef20324f 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -1125,7 +1125,7 @@ CvsResponse CvsPlugin::runCvs(const QString &workingDirectory, unsigned flags, QTextCodec *outputCodec) const { - const QString executable = m_settings.binaryPath(); + const Utils::FileName executable = m_settings.binaryPath(); CvsResponse response; if (executable.isEmpty()) { response.result = CvsResponse::OtherError; @@ -1154,7 +1154,7 @@ CvsResponse CvsPlugin::runCvs(const QString &workingDirectory, } if (response.result != CvsResponse::Ok) - response.message = sp_resp.exitMessage(executable, timeOut); + response.message = sp_resp.exitMessage(executable.toString(), timeOut); return response; } diff --git a/src/plugins/cvs/settingspage.cpp b/src/plugins/cvs/settingspage.cpp index e6d1a16499..16717868ee 100644 --- a/src/plugins/cvs/settingspage.cpp +++ b/src/plugins/cvs/settingspage.cpp @@ -66,7 +66,7 @@ CvsSettings SettingsPageWidget::settings() const void SettingsPageWidget::setSettings(const CvsSettings &s) { - m_ui.commandPathChooser->setPath(s.binaryPath()); + m_ui.commandPathChooser->setFileName(s.binaryPath()); m_ui.rootLineEdit->setText(s.stringValue(CvsSettings::cvsRootKey)); m_ui.diffOptionsLineEdit->setText(s.stringValue(CvsSettings::diffOptionsKey)); m_ui.timeOutSpinBox->setValue(s.intValue(CvsSettings::timeoutKey)); diff --git a/src/plugins/git/changeselectiondialog.cpp b/src/plugins/git/changeselectiondialog.cpp index a22c10783e..39ba5bb008 100644 --- a/src/plugins/git/changeselectiondialog.cpp +++ b/src/plugins/git/changeselectiondialog.cpp @@ -257,7 +257,7 @@ void ChangeSelectionDialog::recalculateDetails() connect(m_process, SIGNAL(finished(int)), this, SLOT(setDetails(int))); - m_process->start(m_gitBinaryPath, args); + m_process->start(m_gitBinaryPath.toString(), args); m_process->closeWriteChannel(); if (!m_process->waitForStarted()) m_ui->detailsText->setPlainText(tr("Error: Could not start Git.")); diff --git a/src/plugins/git/changeselectiondialog.h b/src/plugins/git/changeselectiondialog.h index c1ab0b2b6a..5650c22a2d 100644 --- a/src/plugins/git/changeselectiondialog.h +++ b/src/plugins/git/changeselectiondialog.h @@ -32,6 +32,8 @@ #include <coreplugin/id.h> +#include <utils/fileutils.h> + #include <QDialog> #include <QProcessEnvironment> @@ -87,7 +89,7 @@ private: Ui::ChangeSelectionDialog *m_ui; QProcess *m_process; - QString m_gitBinaryPath; + Utils::FileName m_gitBinaryPath; QProcessEnvironment m_gitEnvironment; ChangeCommand m_command; QStringListModel *m_changeModel; diff --git a/src/plugins/git/gerrit/gerritmodel.cpp b/src/plugins/git/gerrit/gerritmodel.cpp index f811044044..05401283ed 100644 --- a/src/plugins/git/gerrit/gerritmodel.cpp +++ b/src/plugins/git/gerrit/gerritmodel.cpp @@ -314,8 +314,8 @@ void QueryContext::startQuery(const QString &query) { QStringList arguments = m_baseArguments; arguments.push_back(query); - VcsBase::VcsBaseOutputWindow::instance() - ->appendCommand(m_process.workingDirectory(), m_binary, arguments); + VcsBase::VcsBaseOutputWindow::instance()->appendCommand( + m_process.workingDirectory(), Utils::FileName::fromString(m_binary), arguments); m_timer.start(); m_process.start(m_binary, arguments); m_process.closeWriteChannel(); diff --git a/src/plugins/git/gerrit/gerritparameters.cpp b/src/plugins/git/gerrit/gerritparameters.cpp index e5f8922511..50731d5fd8 100644 --- a/src/plugins/git/gerrit/gerritparameters.cpp +++ b/src/plugins/git/gerrit/gerritparameters.cpp @@ -73,10 +73,10 @@ static inline QString detectSsh() if (!ssh.isEmpty()) return ssh; if (Utils::HostOsInfo::isWindowsHost()) { // Windows: Use ssh.exe from git if it cannot be found. - const QString git = GerritPlugin::gitBinary(); + const Utils::FileName git = GerritPlugin::gitBinary(); if (!git.isEmpty()) { // Is 'git\cmd' in the path (folder containing .bats)? - QString path = QFileInfo(git).absolutePath(); + QString path = git.parentDir().toString(); if (path.endsWith(QLatin1String("cmd"), Qt::CaseInsensitive)) path.replace(path.size() - 3, 3, QLatin1String("bin")); ssh = path + QLatin1Char('/') + QLatin1String(defaultSshC); diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp index e89c2242da..d3115b60ec 100644 --- a/src/plugins/git/gerrit/gerritplugin.cpp +++ b/src/plugins/git/gerrit/gerritplugin.cpp @@ -99,7 +99,7 @@ class FetchContext : public QObject Q_OBJECT public: FetchContext(const QSharedPointer<GerritChange> &change, - const QString &repository, const QString &git, + const QString &repository, const Utils::FileName &git, const QSharedPointer<GerritParameters> &p, FetchMode fm, QObject *parent = 0); ~FetchContext(); @@ -129,7 +129,7 @@ private: const QSharedPointer<GerritChange> m_change; const QString m_repository; const FetchMode m_fetchMode; - const QString m_git; + const Utils::FileName m_git; const QSharedPointer<GerritParameters> m_parameters; State m_state; QProcess m_process; @@ -137,7 +137,7 @@ private: }; FetchContext::FetchContext(const QSharedPointer<GerritChange> &change, - const QString &repository, const QString &git, + const QString &repository, const Utils::FileName &git, const QSharedPointer<GerritParameters> &p, FetchMode fm, QObject *parent) : QObject(parent) @@ -179,18 +179,18 @@ void FetchContext::start() // Order: initialize future before starting the process in case error handling is invoked. const QStringList args = m_change->gitFetchArguments(m_parameters); VcsBase::VcsBaseOutputWindow::instance()->appendCommand(m_repository, m_git, args); - m_process.start(m_git, args); + m_process.start(m_git.toString(), args); m_process.closeWriteChannel(); } void FetchContext::processFinished(int exitCode, QProcess::ExitStatus es) { if (es != QProcess::NormalExit) { - handleError(tr("%1 crashed.").arg(m_git)); + handleError(tr("%1 crashed.").arg(m_git.toUserOutput())); return; } if (exitCode) { - handleError(tr("%1 returned %2.").arg(m_git).arg(exitCode)); + handleError(tr("%1 returned %2.").arg(m_git.toUserOutput()).arg(exitCode)); return; } if (m_state == FetchState) { @@ -235,7 +235,7 @@ void FetchContext::handleError(const QString &e) void FetchContext::processError(QProcess::ProcessError e) { - const QString msg = tr("Error running %1: %2").arg(m_git, m_process.errorString()); + const QString msg = tr("Error running %1: %2").arg(m_git.toUserOutput(), m_process.errorString()); if (e == QProcess::FailedToStart) handleError(msg); else @@ -388,13 +388,13 @@ void GerritPlugin::push() push(GitPlugin::instance()->currentState().topLevel()); } -QString GerritPlugin::gitBinary() +Utils::FileName GerritPlugin::gitBinary() { bool ok; - const QString git = gitClient()->gitBinaryPath(&ok); + const Utils::FileName git = gitClient()->gitBinaryPath(&ok); if (!ok) { VcsBase::VcsBaseOutputWindow::instance()->appendError(tr("Git is not available.")); - return QString(); + return Utils::FileName(); } return git; } @@ -423,7 +423,7 @@ void GerritPlugin::fetchCheckout(const QSharedPointer<GerritChange> &change) void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode) { // Locate git. - const QString git = gitBinary(); + const Utils::FileName git = gitBinary(); if (git.isEmpty()) return; diff --git a/src/plugins/git/gerrit/gerritplugin.h b/src/plugins/git/gerrit/gerritplugin.h index cc5723c2f7..781f945974 100644 --- a/src/plugins/git/gerrit/gerritplugin.h +++ b/src/plugins/git/gerrit/gerritplugin.h @@ -30,6 +30,8 @@ #ifndef GERRIT_INTERNAL_GERRITPLUGIN_H #define GERRIT_INTERNAL_GERRITPLUGIN_H +#include <utils/fileutils.h> + #include <QObject> #include <QPointer> #include <QSharedPointer> @@ -61,7 +63,7 @@ public: bool initialize(Core::ActionContainer *ac); - static QString gitBinary(); + static Utils::FileName gitBinary(); static QString branch(const QString &repository); void addToLocator(Core::CommandLocator *locator); void push(const QString &topLevel); diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index da79d36bd7..9debfc7343 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -133,7 +133,7 @@ private: void addJob(VcsBase::Command *command, const QStringList &arguments); int timeout() const; QProcessEnvironment processEnvironment() const; - QString gitPath() const; + Utils::FileName gitPath() const; QPointer<DiffEditor::DiffEditorController> m_controller; const QString m_workingDirectory; @@ -303,7 +303,7 @@ QProcessEnvironment GitDiffHandler::processEnvironment() const return m_gitClient->processEnvironment(); } -QString GitDiffHandler::gitPath() const +Utils::FileName GitDiffHandler::gitPath() const { return m_gitClient->gitBinaryPath(); } @@ -2185,7 +2185,9 @@ VcsBase::Command *GitClient::executeGit(const QString &workingDirectory, unsigned additionalFlags, int editorLineNumber) { - outputWindow()->appendCommand(workingDirectory, settings()->stringValue(GitSettings::binaryPathKey), arguments); + outputWindow()->appendCommand(workingDirectory, + Utils::FileName::fromUserInput(settings()->stringValue(GitSettings::binaryPathKey)), + arguments); VcsBase::Command *command = createCommand(workingDirectory, editor, useOutputToWindow, editorLineNumber); command->addJob(arguments, settings()->intValue(GitSettings::timeoutKey)); command->addFlags(additionalFlags); @@ -2543,7 +2545,7 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR void GitClient::launchGitK(const QString &workingDirectory, const QString &fileName) { - const QFileInfo binaryInfo(gitBinaryPath()); + const QFileInfo binaryInfo = gitBinaryPath().toFileInfo(); QDir foundBinDir(binaryInfo.dir()); const bool foundBinDirIsCmdDir = foundBinDir.dirName() == QLatin1String("cmd"); QProcessEnvironment env = processEnvironment(); @@ -2564,10 +2566,10 @@ void GitClient::launchGitK(const QString &workingDirectory, const QString &fileN } Utils::Environment sysEnv = Utils::Environment::systemEnvironment(); - const QString exec = sysEnv.searchInPath(QLatin1String("gitk")); + const Utils::FileName exec = sysEnv.searchInPath(QLatin1String("gitk")); if (!exec.isEmpty() && tryLauchingGitK(env, workingDirectory, fileName, - QFileInfo(exec).absolutePath())) { + exec.parentDir().toString())) { return; } @@ -2602,7 +2604,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env, arguments.append(Utils::QtcProcess::splitArgs(gitkOpts, Utils::HostOsInfo::hostOs())); if (!fileName.isEmpty()) arguments << QLatin1String("--") << fileName; - outwin->appendCommand(workingDirectory, binary, arguments); + outwin->appendCommand(workingDirectory, Utils::FileName::fromString(binary), arguments); // This should always use QProcess::startDetached (as not to kill // the child), but that does not have an environment parameter. bool success = false; @@ -2625,10 +2627,11 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env, bool GitClient::launchGitGui(const QString &workingDirectory) { bool success; - QString gitBinary = gitBinaryPath(&success); - if (success) - success = QProcess::startDetached(gitBinary, QStringList(QLatin1String("gui")), + Utils::FileName gitBinary = gitBinaryPath(&success); + if (success) { + success = QProcess::startDetached(gitBinary.toString(), QStringList(QLatin1String("gui")), workingDirectory); + } if (!success) outputWindow()->appendError(msgCannotLaunch(QLatin1String("git gui"))); @@ -2636,7 +2639,7 @@ bool GitClient::launchGitGui(const QString &workingDirectory) { return success; } -QString GitClient::gitBinaryPath(bool *ok, QString *errorMessage) const +Utils::FileName GitClient::gitBinaryPath(bool *ok, QString *errorMessage) const { return settings()->gitBinaryPath(ok, errorMessage); } @@ -3269,9 +3272,7 @@ void GitClient::asyncCommand(const QString &workingDirectory, const QStringList // Git might request an editor, so this must be done asynchronously // and without timeout QString gitCommand = arguments.first(); - outputWindow()->appendCommand(workingDirectory, - settings()->stringValue(GitSettings::binaryPathKey), - arguments); + outputWindow()->appendCommand(workingDirectory, settings()->binaryPath(), arguments); VcsBase::Command *command = createCommand(workingDirectory, 0, true); new ConflictHandler(command, workingDirectory, gitCommand); if (hasProgress) @@ -3317,7 +3318,7 @@ void GitClient::interactiveRebase(const QString &workingDirectory, const QString if (fixup) arguments << QLatin1String("--autosquash"); arguments << commit + QLatin1Char('^'); - outputWindow()->appendCommand(workingDirectory, settings()->stringValue(GitSettings::binaryPathKey), arguments); + outputWindow()->appendCommand(workingDirectory, settings()->binaryPath(), arguments); if (fixup) m_disableEditor = true; asyncCommand(workingDirectory, arguments, true); @@ -3506,7 +3507,7 @@ GitSettings *GitClient::settings() const // determine version as '(major << 16) + (minor << 8) + patch' or 0. unsigned GitClient::gitVersion(QString *errorMessage) const { - const QString newGitBinary = gitBinaryPath(); + const Utils::FileName newGitBinary = gitBinaryPath(); if (m_gitVersionForBinary != newGitBinary && !newGitBinary.isEmpty()) { // Do not execute repeatedly if that fails (due to git // not being installed) until settings are changed. diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 9c54da4f94..b10022d2ba 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -134,7 +134,7 @@ public: explicit GitClient(GitSettings *settings); ~GitClient(); - QString gitBinaryPath(bool *ok = 0, QString *errorMessage = 0) const; + Utils::FileName gitBinaryPath(bool *ok = 0, QString *errorMessage = 0) const; unsigned gitVersion(QString *errorMessage = 0) const; QString findRepositoryForDirectory(const QString &dir); @@ -423,7 +423,7 @@ private: QString msgBoxText, const QString &buttonName, const QString &gitCommand, ContinueCommandMode continueMode); - mutable QString m_gitVersionForBinary; + mutable Utils::FileName m_gitVersionForBinary; mutable unsigned m_cachedGitVersion; const QString m_msgWait; diff --git a/src/plugins/git/gitsettings.cpp b/src/plugins/git/gitsettings.cpp index 177c49884a..84e6ce500d 100644 --- a/src/plugins/git/gitsettings.cpp +++ b/src/plugins/git/gitsettings.cpp @@ -70,7 +70,7 @@ GitSettings::GitSettings() declareKey(lastResetIndexKey, 0); } -QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const +Utils::FileName GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const { // Locate binary in path if one is specified, otherwise default // to pathless binary @@ -79,7 +79,7 @@ QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const if (errorMessage) errorMessage->clear(); - QString binPath = binaryPath(); + Utils::FileName binPath = binaryPath(); if (binPath.isEmpty()) { if (ok) *ok = false; diff --git a/src/plugins/git/gitsettings.h b/src/plugins/git/gitsettings.h index 0c813caee3..db3887fc5c 100644 --- a/src/plugins/git/gitsettings.h +++ b/src/plugins/git/gitsettings.h @@ -62,7 +62,7 @@ public: static const QLatin1String graphLogKey; static const QLatin1String lastResetIndexKey; - QString gitBinaryPath(bool *ok = 0, QString *errorMessage = 0) const; + Utils::FileName gitBinaryPath(bool *ok = 0, QString *errorMessage = 0) const; GitSettings &operator = (const GitSettings &s); }; diff --git a/src/plugins/git/mergetool.cpp b/src/plugins/git/mergetool.cpp index 5df7b3e32b..760acc9f72 100644 --- a/src/plugins/git/mergetool.cpp +++ b/src/plugins/git/mergetool.cpp @@ -98,9 +98,9 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files) } m_process = new MergeToolProcess(this); m_process->setWorkingDirectory(workingDirectory); - const QString binary = m_gitClient->gitBinaryPath(); + const Utils::FileName binary = m_gitClient->gitBinaryPath(); VcsBase::VcsBaseOutputWindow::instance()->appendCommand(workingDirectory, binary, arguments); - m_process->start(binary, arguments); + m_process->start(binary.toString(), arguments); if (m_process->waitForStarted()) { connect(m_process, SIGNAL(finished(int)), this, SLOT(done())); connect(m_process, SIGNAL(readyRead()), this, SLOT(readData())); diff --git a/src/plugins/mercurial/mercurialclient.cpp b/src/plugins/mercurial/mercurialclient.cpp index 98a3c8abb4..bd29ee0940 100644 --- a/src/plugins/mercurial/mercurialclient.cpp +++ b/src/plugins/mercurial/mercurialclient.cpp @@ -140,7 +140,7 @@ bool MercurialClient::synchronousPull(const QString &workingDir, const QString & VcsBase::VcsBasePlugin::SshPasswordPrompt | VcsBase::VcsBasePlugin::ShowStdOutInLogWindow | VcsBase::VcsBasePlugin::ShowSuccessMessage; - const QString binary = settings()->binaryPath(); + const Utils::FileName binary = settings()->binaryPath(); const int timeoutSec = settings()->value(settings()->timeoutKey).toInt(); // cause mercurial doesn`t understand LANG diff --git a/src/plugins/mercurial/mercurialcontrol.cpp b/src/plugins/mercurial/mercurialcontrol.cpp index 0b763952ad..c5090e2229 100644 --- a/src/plugins/mercurial/mercurialcontrol.cpp +++ b/src/plugins/mercurial/mercurialcontrol.cpp @@ -94,10 +94,10 @@ bool MercurialControl::managesFile(const QString &workingDirectory, const QStrin bool MercurialControl::isConfigured() const { - const QString binary = mercurialClient->settings()->binaryPath(); + const Utils::FileName binary = mercurialClient->settings()->binaryPath(); if (binary.isEmpty()) return false; - QFileInfo fi(binary); + QFileInfo fi = binary.toFileInfo(); return fi.exists() && fi.isFile() && fi.isExecutable(); } diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index 76d4f86d2f..49ccd0c1b3 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -1147,8 +1147,11 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QString &workingDir, } actualArgs.append(args); - if (flags & CommandToWindow) - outputWindow->appendCommand(workingDir, settings().p4BinaryPath(), actualArgs); + if (flags & CommandToWindow) { + outputWindow->appendCommand(workingDir, + Utils::FileName::fromString(settings().p4BinaryPath()), + actualArgs); + } if (flags & ShowBusyCursor) QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); diff --git a/src/plugins/perforce/perforcesettings.cpp b/src/plugins/perforce/perforcesettings.cpp index 9a9f301795..98ac16feff 100644 --- a/src/plugins/perforce/perforcesettings.cpp +++ b/src/plugins/perforce/perforcesettings.cpp @@ -109,7 +109,8 @@ void PerforceSettings::fromSettings(QSettings *settings) { settings->beginGroup(QLatin1String(groupC)); m_settings.p4Command = settings->value(QLatin1String(commandKeyC), defaultCommand()).toString(); - m_settings.p4BinaryPath = Utils::Environment::systemEnvironment().searchInPath(m_settings.p4Command); + m_settings.p4BinaryPath = + Utils::Environment::systemEnvironment().searchInPath(m_settings.p4Command).toString(); m_settings.defaultEnv = settings->value(QLatin1String(defaultKeyC), true).toBool(); m_settings.p4Port = settings->value(QLatin1String(portKeyC), QString()).toString(); m_settings.p4Client = settings->value(QLatin1String(clientKeyC), QString()).toString(); diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp index 3964f8f8e0..ed2ce6b874 100644 --- a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp +++ b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp @@ -185,17 +185,17 @@ QString AbstractMsvcToolChain::makeCommand(const Utils::Environment &environment bool useJom = ProjectExplorerPlugin::projectExplorerSettings().useJom; const QString jom = QLatin1String("jom.exe"); const QString nmake = QLatin1String("nmake.exe"); - QString tmp; + Utils::FileName tmp; if (useJom) { tmp = environment.searchInPath(jom, QStringList() << QCoreApplication::applicationDirPath()); if (!tmp.isEmpty()) - return tmp; + return tmp.toString(); } tmp = environment.searchInPath(nmake); if (!tmp.isEmpty()) - return tmp; + return tmp.toString(); // Nothing found :( return useJom ? jom : nmake; @@ -205,7 +205,7 @@ Utils::FileName AbstractMsvcToolChain::compilerCommand() const { Utils::Environment env = Utils::Environment::systemEnvironment(); addToEnvironment(env); - return Utils::FileName::fromString(env.searchInPath(QLatin1String("cl.exe"))); + return env.searchInPath(QLatin1String("cl.exe")); } IOutputParser *AbstractMsvcToolChain::outputParser() const @@ -273,14 +273,14 @@ bool AbstractMsvcToolChain::generateEnvironmentSettings(Utils::Environment &env, // if Creator is launched within a session set up by setenv.cmd. env.unset(QLatin1String("ORIGINALPATH")); run.setEnvironment(env); - QString cmdPath = QString::fromLocal8Bit(qgetenv("COMSPEC")); + Utils::FileName cmdPath = Utils::FileName::fromUserInput(QString::fromLocal8Bit(qgetenv("COMSPEC"))); if (cmdPath.isEmpty()) cmdPath = env.searchInPath(QLatin1String("cmd.exe")); // Windows SDK setup scripts require command line switches for environment expansion. QString cmdArguments = QLatin1String(" /E:ON /V:ON /c \""); cmdArguments += QDir::toNativeSeparators(saver.fileName()); cmdArguments += QLatin1Char('"'); - run.setCommand(cmdPath, cmdArguments); + run.setCommand(cmdPath.toString(), cmdArguments); if (debug) qDebug() << "readEnvironmentSetting: " << call << cmdPath << cmdArguments << " Env: " << env.size(); diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index afd6952e23..caea364733 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -596,8 +596,8 @@ QList<FileName> GccToolChain::suggestedMkspecList() const QString GccToolChain::makeCommand(const Utils::Environment &environment) const { QString make = QLatin1String("make"); - QString tmp = environment.searchInPath(make); - return tmp.isEmpty() ? make : tmp; + FileName tmp = environment.searchInPath(make); + return tmp.isEmpty() ? make : tmp.toString(); } IOutputParser *GccToolChain::outputParser() const @@ -809,7 +809,7 @@ QList<ToolChain *> GccToolChainFactory::autoDetectToolchains(const QString &comp QList<ToolChain *> result; Environment systemEnvironment = Environment::systemEnvironment(); - const FileName compilerPath = FileName::fromString(systemEnvironment.searchInPath(compiler)); + const FileName compilerPath = systemEnvironment.searchInPath(compiler); if (compilerPath.isEmpty()) return result; @@ -1023,11 +1023,11 @@ QString ClangToolChain::makeCommand(const Utils::Environment &environment) const makes << QLatin1String("make"); } - QString tmp; + FileName tmp; foreach (const QString &make, makes) { tmp = environment.searchInPath(make); if (!tmp.isEmpty()) - return tmp; + return tmp.toString(); } return makes.first(); } @@ -1188,11 +1188,11 @@ QString MingwToolChain::makeCommand(const Utils::Environment &environment) const makes << QLatin1String("make"); } - QString tmp; + FileName tmp; foreach (const QString &make, makes) { tmp = environment.searchInPath(make); if (!tmp.isEmpty()) - return tmp; + return tmp.toString(); } return makes.first(); } diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index 265532887a..1b2f92dc90 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -238,27 +238,27 @@ QByteArray MsvcToolChain::msvcPredefinedMacros(const QStringList cxxflags, cpp.setEnvironment(env.toStringList()); cpp.setWorkingDirectory(QDir::tempPath()); QStringList arguments; - const QString binary = env.searchInPath(QLatin1String("cl.exe")); + const Utils::FileName binary = env.searchInPath(QLatin1String("cl.exe")); if (binary.isEmpty()) { qWarning("%s: The compiler binary cl.exe could not be found in the path.", Q_FUNC_INFO); return predefinedMacros; } arguments << toProcess << QLatin1String("/EP") << QDir::toNativeSeparators(saver.fileName()); - cpp.start(binary, arguments); + cpp.start(binary.toString(), arguments); if (!cpp.waitForStarted()) { - qWarning("%s: Cannot start '%s': %s", Q_FUNC_INFO, qPrintable(binary), + qWarning("%s: Cannot start '%s': %s", Q_FUNC_INFO, qPrintable(binary.toUserOutput()), qPrintable(cpp.errorString())); return predefinedMacros; } cpp.closeWriteChannel(); if (!cpp.waitForFinished()) { Utils::SynchronousProcess::stopProcess(cpp); - qWarning("%s: Timeout running '%s'.", Q_FUNC_INFO, qPrintable(binary)); + qWarning("%s: Timeout running '%s'.", Q_FUNC_INFO, qPrintable(binary.toUserOutput())); return predefinedMacros; } if (cpp.exitStatus() != QProcess::NormalExit) { - qWarning("%s: '%s' crashed.", Q_FUNC_INFO, qPrintable(binary)); + qWarning("%s: '%s' crashed.", Q_FUNC_INFO, qPrintable(binary.toUserOutput())); return predefinedMacros; } diff --git a/src/plugins/projectexplorer/processparameters.cpp b/src/plugins/projectexplorer/processparameters.cpp index 711209b872..c50f76edcc 100644 --- a/src/plugins/projectexplorer/processparameters.cpp +++ b/src/plugins/projectexplorer/processparameters.cpp @@ -128,8 +128,8 @@ QString ProcessParameters::effectiveCommand() const QString cmd = m_command; if (m_macroExpander) Utils::expandMacros(&cmd, m_macroExpander); - m_effectiveCommand = QDir::cleanPath(m_environment.searchInPath( - cmd, QStringList() << effectiveWorkingDirectory())); + m_effectiveCommand = + m_environment.searchInPath(cmd, QStringList(effectiveWorkingDirectory())).toString(); m_commandMissing = m_effectiveCommand.isEmpty(); if (m_commandMissing) m_effectiveCommand = cmd; diff --git a/src/plugins/projectexplorer/settingsaccessor.cpp b/src/plugins/projectexplorer/settingsaccessor.cpp index 929cb2f094..101d77546b 100644 --- a/src/plugins/projectexplorer/settingsaccessor.cpp +++ b/src/plugins/projectexplorer/settingsaccessor.cpp @@ -2068,7 +2068,7 @@ QVariantMap UserFileVersion11Upgrader::upgrade(const QVariantMap &map) if (m_toolChainExtras.contains(origTcId)) { debuggerPath = m_toolChainExtras.value(origTcId).m_debugger; if (!debuggerPath.isEmpty() && !QFileInfo(debuggerPath).isAbsolute()) - debuggerPath = Environment::systemEnvironment().searchInPath(debuggerPath); + debuggerPath = Environment::systemEnvironment().searchInPath(debuggerPath).toString(); if (debuggerPath.contains(QLatin1String("cdb"))) debuggerEngine = 4; // CDB mkspec = m_toolChainExtras.value(origTcId).m_mkspec; diff --git a/src/plugins/qnx/blackberryapplicationrunner.cpp b/src/plugins/qnx/blackberryapplicationrunner.cpp index 20d210d846..64447725a6 100644 --- a/src/plugins/qnx/blackberryapplicationrunner.cpp +++ b/src/plugins/qnx/blackberryapplicationrunner.cpp @@ -86,7 +86,7 @@ BlackBerryApplicationRunner::BlackBerryApplicationRunner(const BlackBerryApplica Target *target = runConfiguration->target(); BuildConfiguration *buildConfig = target->activeBuildConfiguration(); m_environment = buildConfig->environment(); - m_deployCmd = m_environment.searchInPath(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD)); + m_deployCmd = m_environment.searchInPath(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD)).toString(); QFileInfo fi(target->kit()->autoDetectionSource()); m_bbApiLevelVersion = QnxVersionNumber::fromNdkEnvFileName(fi.baseName()); @@ -310,7 +310,7 @@ void BlackBerryApplicationRunner::checkQmlJsDebugArguments() } emit output(tr("Checking qmljsdebugger command line argument."), Utils::StdOutFormat); - QString nativePackagerCmd = m_environment.searchInPath(QLatin1String("blackberry-nativepackager")); + QString nativePackagerCmd = m_environment.searchInPath(QLatin1String("blackberry-nativepackager")).toString(); if (nativePackagerCmd.isEmpty()) { emit output(tr("Cannot find Native Packager executable."), Utils::StdErrFormat); return; diff --git a/src/plugins/qnx/blackberrycreatepackagestep.cpp b/src/plugins/qnx/blackberrycreatepackagestep.cpp index 2227315a13..0af33f58dd 100644 --- a/src/plugins/qnx/blackberrycreatepackagestep.cpp +++ b/src/plugins/qnx/blackberrycreatepackagestep.cpp @@ -225,7 +225,8 @@ bool BlackBerryCreatePackageStep::init() if (!BlackBerryAbstractDeployStep::init()) return false; - const QString packageCmd = target()->activeBuildConfiguration()->environment().searchInPath(QLatin1String(PACKAGER_CMD)); + const Utils::FileName packageCmd = + target()->activeBuildConfiguration()->environment().searchInPath(QLatin1String(PACKAGER_CMD)); if (packageCmd.isEmpty()) { raiseError(tr("Could not find packager command \"%1\" in the build environment.") .arg(QLatin1String(PACKAGER_CMD))); @@ -296,7 +297,7 @@ bool BlackBerryCreatePackageStep::init() args << QLatin1String("-package") << QnxUtils::addQuotes(QDir::toNativeSeparators(info.packagePath())); args << QnxUtils::addQuotes(QDir::toNativeSeparators(appDescriptorPath)); - addCommand(packageCmd, args); + addCommand(packageCmd.toString(), args); } return true; diff --git a/src/plugins/qnx/blackberrydeploystep.cpp b/src/plugins/qnx/blackberrydeploystep.cpp index a0fe3286c9..04d255b85b 100644 --- a/src/plugins/qnx/blackberrydeploystep.cpp +++ b/src/plugins/qnx/blackberrydeploystep.cpp @@ -69,7 +69,9 @@ bool BlackBerryDeployStep::init() if (!BlackBerryAbstractDeployStep::init()) return false; - QString deployCmd = target()->activeBuildConfiguration()->environment().searchInPath(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD)); + Utils::FileName deployCmd = + target()->activeBuildConfiguration()->environment().searchInPath( + QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD)); if (deployCmd.isEmpty()) { raiseError(tr("Could not find deploy command \"%1\" in the build environment") .arg(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD))); @@ -98,7 +100,7 @@ bool BlackBerryDeployStep::init() args << QLatin1String("-password") << password(); args << QnxUtils::addQuotes(QDir::toNativeSeparators(info.packagePath())); - addCommand(deployCmd, args); + addCommand(deployCmd.toString(), args); } return true; diff --git a/src/plugins/qnx/blackberrydeviceconnection.cpp b/src/plugins/qnx/blackberrydeviceconnection.cpp index a3578151e7..fc69c2890a 100644 --- a/src/plugins/qnx/blackberrydeviceconnection.cpp +++ b/src/plugins/qnx/blackberrydeviceconnection.cpp @@ -71,7 +71,7 @@ void BlackBerryDeviceConnection::connectDevice(const ProjectExplorer::IDevice::C // Since killing the blackberry-connect script won't kill the java process it launches, // let's just call the java process directly instead. - QString command = env.searchInPath(QLatin1String("java")); + Utils::FileName command = env.searchInPath(QLatin1String("java")); if (command.isEmpty()) { const QString line = tr("Error connecting to device: java could not be found in the environment.") + QLatin1Char('\n'); emit processOutput(line); @@ -90,7 +90,7 @@ void BlackBerryDeviceConnection::connectDevice(const ProjectExplorer::IDevice::C args << QLatin1String("-sshPublicKey") << publicKeyFile; m_connectionState = Connecting; - m_process->start(command, args); + m_process->start(command.toString(), args); m_messageLog.clear(); emit deviceAboutToConnect(); } diff --git a/src/plugins/qtsupport/customexecutablerunconfiguration.cpp b/src/plugins/qtsupport/customexecutablerunconfiguration.cpp index f6f63034ce..8de9ce2ae2 100644 --- a/src/plugins/qtsupport/customexecutablerunconfiguration.cpp +++ b/src/plugins/qtsupport/customexecutablerunconfiguration.cpp @@ -181,8 +181,8 @@ bool CustomExecutableRunConfiguration::validateExecutable(QString *executable, Q EnvironmentAspect *aspect = extraAspect<EnvironmentAspect>(); if (aspect) env = aspect->environment(); - const QString exec = env.searchInPath(Utils::expandMacros(m_executable, macroExpander()), - QStringList(workingDirectory())); + const Utils::FileName exec = env.searchInPath(Utils::expandMacros(m_executable, macroExpander()), + QStringList(workingDirectory())); if (exec.isEmpty()) { if (errorMessage) *errorMessage = tr("The executable\n%1\ncannot be found in the path."). @@ -190,7 +190,7 @@ bool CustomExecutableRunConfiguration::validateExecutable(QString *executable, Q return false; } if (executable) - *executable = QDir::cleanPath(exec); + *executable = exec.toString(); return true; } diff --git a/src/plugins/subversion/checkoutwizard.cpp b/src/plugins/subversion/checkoutwizard.cpp index 5b703871e5..566ec4bdec 100644 --- a/src/plugins/subversion/checkoutwizard.cpp +++ b/src/plugins/subversion/checkoutwizard.cpp @@ -82,7 +82,7 @@ VcsBase::Command *CheckoutWizard::createCommand(Utils::FileName *checkoutDir) QTC_ASSERT(cwp, return 0); const SubversionSettings settings = SubversionPlugin::instance()->settings(); - const QString binary = settings.binaryPath(); + const Utils::FileName binary = settings.binaryPath(); const QString directory = cwp->directory(); QStringList args; args << QLatin1String("checkout") << cwp->repository() << directory; diff --git a/src/plugins/subversion/settingspage.cpp b/src/plugins/subversion/settingspage.cpp index 41dec9b870..9d383fed3c 100644 --- a/src/plugins/subversion/settingspage.cpp +++ b/src/plugins/subversion/settingspage.cpp @@ -71,7 +71,7 @@ SubversionSettings SettingsPageWidget::settings() const void SettingsPageWidget::setSettings(const SubversionSettings &s) { - m_ui.pathChooser->setPath(s.binaryPath()); + m_ui.pathChooser->setFileName(s.binaryPath()); m_ui.usernameLineEdit->setText(s.stringValue(SubversionSettings::userKey)); m_ui.passwordLineEdit->setText(s.stringValue(SubversionSettings::passwordKey)); m_ui.userGroupBox->setChecked(s.boolValue(SubversionSettings::useAuthenticationKey)); diff --git a/src/plugins/subversion/subversionclient.h b/src/plugins/subversion/subversionclient.h index 421797040c..f515219641 100644 --- a/src/plugins/subversion/subversionclient.h +++ b/src/plugins/subversion/subversionclient.h @@ -33,6 +33,8 @@ #include "subversionsettings.h" #include <vcsbase/vcsbaseclient.h> +#include <utils/fileutils.h> + namespace Subversion { namespace Internal { @@ -83,7 +85,7 @@ protected: const QStringList &files, const QStringList &extraOptions); private: - QString m_svnVersionBinary; + Utils::FileName m_svnVersionBinary; QString m_svnVersion; }; diff --git a/src/plugins/subversion/subversioncontrol.cpp b/src/plugins/subversion/subversioncontrol.cpp index 833e8d939d..bdd1dc87c8 100644 --- a/src/plugins/subversion/subversioncontrol.cpp +++ b/src/plugins/subversion/subversioncontrol.cpp @@ -55,10 +55,10 @@ Core::Id SubversionControl::id() const bool SubversionControl::isConfigured() const { - const QString binary = m_plugin->settings().binaryPath(); + const Utils::FileName binary = m_plugin->settings().binaryPath(); if (binary.isEmpty()) return false; - QFileInfo fi(binary); + QFileInfo fi = binary.toFileInfo(); return fi.exists() && fi.isFile() && fi.isExecutable(); } diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 942fd1ab20..0cc150ce1f 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -1000,7 +1000,7 @@ SubversionResponse SubversionPlugin::runSvn(const QString &workingDir, const QStringList &arguments, int timeOut, unsigned flags, QTextCodec *outputCodec) const { - const QString executable = m_settings.binaryPath(); + const FileName executable = m_settings.binaryPath(); SubversionResponse response; if (executable.isEmpty()) { response.error = true; @@ -1015,7 +1015,7 @@ SubversionResponse SubversionPlugin::runSvn(const QString &workingDir, response.error = sp_resp.result != SynchronousProcessResponse::Finished; if (response.error) - response.message = sp_resp.exitMessage(executable, timeOut); + response.message = sp_resp.exitMessage(executable.toString(), timeOut); response.stdErr = sp_resp.stdErr; response.stdOut = sp_resp.stdOut; return response; diff --git a/src/plugins/vcsbase/command.cpp b/src/plugins/vcsbase/command.cpp index e2cb27f468..9f775081d1 100644 --- a/src/plugins/vcsbase/command.cpp +++ b/src/plugins/vcsbase/command.cpp @@ -86,12 +86,12 @@ public: Utils::ExitCodeInterpreter *exitCodeInterpreter; }; - CommandPrivate(const QString &binary, + CommandPrivate(const Utils::FileName &binary, const QString &workingDirectory, const QProcessEnvironment &environment); ~CommandPrivate(); - const QString m_binaryPath; + const Utils::FileName m_binaryPath; const QString m_workingDirectory; const QProcessEnvironment m_environment; QVariant m_cookie; @@ -113,7 +113,7 @@ public: int m_lastExecExitCode; }; -CommandPrivate::CommandPrivate(const QString &binary, +CommandPrivate::CommandPrivate(const Utils::FileName &binary, const QString &workingDirectory, const QProcessEnvironment &environment) : m_binaryPath(binary), @@ -151,7 +151,7 @@ CommandPrivate::Job::Job(const QStringList &a, int t, Utils::ExitCodeInterpreter } // namespace Internal -Command::Command(const QString &binary, +Command::Command(const Utils::FileName &binary, const QString &workingDirectory, const QProcessEnvironment &environment) : d(new Internal::CommandPrivate(binary, workingDirectory, environment)) @@ -165,7 +165,7 @@ Command::~Command() delete d; } -const QString &Command::binaryPath() const +const Utils::FileName &Command::binaryPath() const { return d->m_binaryPath; } @@ -222,7 +222,7 @@ void Command::execute() QFuture<void> task = QtConcurrent::run(&Command::run, this); d->m_watcher.setFuture(task); connect(&d->m_watcher, SIGNAL(canceled()), this, SLOT(cancel())); - QString binary = QFileInfo(d->m_binaryPath).baseName(); + QString binary = d->m_binaryPath.toFileInfo().baseName(); if (!binary.isEmpty()) binary = binary.replace(0, 1, binary[0].toUpper()); // Upper the first letter const QString taskName = binary + QLatin1Char(' ') + d->m_jobs.front().arguments.at(0); @@ -255,7 +255,7 @@ int Command::lastExecutionExitCode() const void Command::run(QFutureInterface<void> &future) { // Check that the binary path is not empty - if (binaryPath().trimmed().isEmpty()) { + if (binaryPath().isEmpty()) { emit errorText(tr("Unable to start process, binary is empty")); return; } @@ -346,7 +346,7 @@ Utils::SynchronousProcessResponse Command::runVcs(const QStringList &arguments, } if (!(d->m_flags & VcsBasePlugin::SuppressCommandLogging)) - emit outputProxy.appendCommand(d->m_workingDirectory, d->m_binaryPath, arguments); + emit outputProxy.appendCommand(d->m_workingDirectory, d->m_binaryPath.toString(), arguments); const bool sshPromptConfigured = !d->m_sshPasswordPrompt.isEmpty(); if (debugExecution) { @@ -420,16 +420,19 @@ Utils::SynchronousProcessResponse Command::runVcs(const QStringList &arguments, process.setTimeOutMessageBoxEnabled(true); // Run! - response = process.run(d->m_binaryPath, arguments); + response = process.run(d->m_binaryPath.toString(), arguments); } if (!d->m_aborted) { // Success/Fail message in appropriate window? if (response.result == Utils::SynchronousProcessResponse::Finished) { - if (d->m_flags & VcsBasePlugin::ShowSuccessMessage) - emit outputProxy.appendMessage(response.exitMessage(d->m_binaryPath, timeoutMS)); + if (d->m_flags & VcsBasePlugin::ShowSuccessMessage) { + emit outputProxy.appendMessage(response.exitMessage(d->m_binaryPath.toUserOutput(), + timeoutMS)); + } } else if (!(d->m_flags & VcsBasePlugin::SuppressFailMessageInLogWindow)) { - emit outputProxy.appendError(response.exitMessage(d->m_binaryPath, timeoutMS)); + emit outputProxy.appendError(response.exitMessage(d->m_binaryPath.toUserOutput(), + timeoutMS)); } } emitRepositoryChanged(); @@ -458,7 +461,7 @@ Utils::SynchronousProcessResponse Command::runSynchronous(const QStringList &arg process->setProcessChannelMode(QProcess::MergedChannels); // Start - process->start(d->m_binaryPath, arguments, QIODevice::ReadOnly); + process->start(d->m_binaryPath.toString(), arguments, QIODevice::ReadOnly); process->closeWriteChannel(); if (!process->waitForStarted()) { response.result = Utils::SynchronousProcessResponse::StartFailed; @@ -522,7 +525,7 @@ bool Command::runFullySynchronous(const QStringList &arguments, int timeoutMS, OutputProxy outputProxy; if (!(d->m_flags & VcsBasePlugin::SuppressCommandLogging)) - emit outputProxy.appendCommand(d->m_workingDirectory, d->m_binaryPath, arguments); + emit outputProxy.appendCommand(d->m_workingDirectory, d->m_binaryPath.toUserOutput(), arguments); // TODO tell the document manager about expected repository changes // if (d->m_flags & ExpectRepoChanges) @@ -531,12 +534,12 @@ bool Command::runFullySynchronous(const QStringList &arguments, int timeoutMS, process.setWorkingDirectory(d->m_workingDirectory); process.setProcessEnvironment(d->m_environment); - process.start(d->m_binaryPath, arguments); + process.start(d->m_binaryPath.toString(), arguments); process.closeWriteChannel(); if (!process.waitForStarted()) { if (errorData) { const QString msg = QString::fromLatin1("Unable to execute \"%1\": %2:") - .arg(d->m_binaryPath, process.errorString()); + .arg(d->m_binaryPath.toUserOutput(), process.errorString()); *errorData = msg.toLocal8Bit(); } return false; diff --git a/src/plugins/vcsbase/command.h b/src/plugins/vcsbase/command.h index ae4c6be560..cde50a7b62 100644 --- a/src/plugins/vcsbase/command.h +++ b/src/plugins/vcsbase/command.h @@ -32,6 +32,7 @@ #include "vcsbase_global.h" +#include <utils/fileutils.h> #include <utils/synchronousprocess.h> #include <QObject> @@ -72,7 +73,7 @@ class VCSBASE_EXPORT Command : public QObject Q_OBJECT public: - Command(const QString &binary, + Command(const Utils::FileName &binary, const QString &workingDirectory, const QProcessEnvironment &environment); ~Command(); @@ -84,7 +85,7 @@ public: bool lastExecutionSuccess() const; int lastExecutionExitCode() const; - const QString &binaryPath() const; + const Utils::FileName &binaryPath() const; const QString &workingDirectory() const; const QProcessEnvironment &processEnvironment() const; diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index 60d0d625b0..8ca2a27780 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -283,15 +283,15 @@ bool VcsBaseClient::vcsFullySynchronousExec(const QString &workingDir, vcsProcess.setWorkingDirectory(workingDir); vcsProcess.setProcessEnvironment(processEnvironment()); - const QString binary = settings()->binaryPath(); + const Utils::FileName binary = settings()->binaryPath(); ::vcsOutputWindow()->appendCommand(workingDir, binary, args); - vcsProcess.start(binary, args); + vcsProcess.start(binary.toString(), args); if (!vcsProcess.waitForStarted()) { ::vcsOutputWindow()->appendError(tr("Unable to start process \"%1\": %2") - .arg(QDir::toNativeSeparators(binary), vcsProcess.errorString())); + .arg(binary.toUserOutput(), vcsProcess.errorString())); return false; } @@ -303,7 +303,7 @@ bool VcsBaseClient::vcsFullySynchronousExec(const QString &workingDir, output, &stdErr, true)) { Utils::SynchronousProcess::stopProcess(vcsProcess); ::vcsOutputWindow()->appendError(tr("Timed out after %1s waiting for the process %2 to finish.") - .arg(timeoutSec).arg(binary)); + .arg(timeoutSec).arg(binary.toUserOutput())); return false; } if (!stdErr.isEmpty()) @@ -318,10 +318,10 @@ Utils::SynchronousProcessResponse VcsBaseClient::vcsSynchronousExec( unsigned flags, QTextCodec *outputCodec) const { - const QString binary = settings()->binaryPath(); + const Utils::FileName binary = settings()->binaryPath(); const int timeoutSec = settings()->intValue(VcsBaseClientSettings::timeoutKey); - return VcsBase::VcsBasePlugin::runVcs(workingDirectory, binary, args, timeoutSec * 1000, - flags, outputCodec); + return VcsBase::VcsBasePlugin::runVcs(workingDirectory, binary, args, + timeoutSec * 1000, flags, outputCodec); } void VcsBaseClient::annotate(const QString &workingDir, const QString &file, @@ -555,8 +555,8 @@ VcsBaseEditorParameterWidget *VcsBaseClient::createLogEditor(const QString &work QString VcsBaseClient::vcsEditorTitle(const QString &vcsCmd, const QString &sourceId) const { - const QString binary = settings()->binaryPath(); - return QFileInfo(binary).baseName() + + const Utils::FileName binary = settings()->binaryPath(); + return binary.toFileInfo().baseName() + QLatin1Char(' ') + vcsCmd + QLatin1Char(' ') + QFileInfo(sourceId).fileName(); } @@ -602,8 +602,8 @@ Command *VcsBaseClient::createCommand(const QString &workingDirectory, VcsBase::VcsBaseEditorWidget *editor, JobOutputBindMode mode) const { - Command *cmd = new Command(d->m_clientSettings->binaryPath(), - workingDirectory, processEnvironment()); + Command *cmd = new Command(d->m_clientSettings->binaryPath(), workingDirectory, + processEnvironment()); cmd->setDefaultTimeout(d->m_clientSettings->intValue(VcsBaseClientSettings::timeoutKey)); if (editor) d->bindCommandToEditor(cmd, editor); diff --git a/src/plugins/vcsbase/vcsbaseclientsettings.cpp b/src/plugins/vcsbase/vcsbaseclientsettings.cpp index 377e288d39..6260971299 100644 --- a/src/plugins/vcsbase/vcsbaseclientsettings.cpp +++ b/src/plugins/vcsbase/vcsbaseclientsettings.cpp @@ -30,6 +30,7 @@ #include "vcsbaseclientsettings.h" #include <utils/environment.h> +#include <utils/fileutils.h> #include <utils/hostosinfo.h> #include <utils/qtcassert.h> @@ -177,7 +178,7 @@ public: QHash<QString, SettingValue> m_valueHash; QVariantHash m_defaultValueHash; QString m_settingsGroup; - mutable QString m_binaryFullPath; + mutable Utils::FileName m_binaryFullPath; }; } // namespace Internal @@ -353,7 +354,7 @@ QVariant::Type VcsBaseClientSettings::valueType(const QString &key) const return QVariant::Invalid; } -QString VcsBaseClientSettings::binaryPath() const +Utils::FileName VcsBaseClientSettings::binaryPath() const { if (d->m_binaryFullPath.isEmpty()) { d->m_binaryFullPath = Utils::Environment::systemEnvironment().searchInPath( diff --git a/src/plugins/vcsbase/vcsbaseclientsettings.h b/src/plugins/vcsbase/vcsbaseclientsettings.h index d87fd8004b..dc9c45eec6 100644 --- a/src/plugins/vcsbase/vcsbaseclientsettings.h +++ b/src/plugins/vcsbase/vcsbaseclientsettings.h @@ -32,6 +32,8 @@ #include "vcsbase_global.h" +#include <utils/fileutils.h> + #include <QStringList> #include <QVariant> #include <QSharedDataPointer> @@ -81,7 +83,7 @@ public: void setValue(const QString &key, const QVariant &v); QVariant::Type valueType(const QString &key) const; - QString binaryPath() const; + Utils::FileName binaryPath() const; QStringList searchPathList() const; diff --git a/src/plugins/vcsbase/vcsbaseoutputwindow.cpp b/src/plugins/vcsbase/vcsbaseoutputwindow.cpp index be9413f694..935e22c5b9 100644 --- a/src/plugins/vcsbase/vcsbaseoutputwindow.cpp +++ b/src/plugins/vcsbase/vcsbaseoutputwindow.cpp @@ -31,6 +31,7 @@ #include <coreplugin/editormanager/editormanager.h> +#include <utils/fileutils.h> #include <utils/outputformatter.h> #include <QPlainTextEdit> @@ -453,11 +454,11 @@ static inline QString formatArguments(const QStringList &args) } QString VcsBaseOutputWindow::msgExecutionLogEntry(const QString &workingDir, - const QString &executable, + const Utils::FileName &executable, const QStringList &arguments) { const QString args = formatArguments(arguments); - const QString nativeExecutable = QDir::toNativeSeparators(executable); + const QString nativeExecutable = executable.toUserOutput(); if (workingDir.isEmpty()) return tr("Executing: %1 %2").arg(nativeExecutable, args) + QLatin1Char('\n'); return tr("Executing in %1: %2 %3"). @@ -470,7 +471,7 @@ void VcsBaseOutputWindow::appendCommand(const QString &text) } void VcsBaseOutputWindow::appendCommand(const QString &workingDirectory, - const QString &binary, + const Utils::FileName &binary, const QStringList &args) { appendCommand(msgExecutionLogEntry(workingDirectory, binary, args)); diff --git a/src/plugins/vcsbase/vcsbaseoutputwindow.h b/src/plugins/vcsbase/vcsbaseoutputwindow.h index 84fa6999bb..0f52426a76 100644 --- a/src/plugins/vcsbase/vcsbaseoutputwindow.h +++ b/src/plugins/vcsbase/vcsbaseoutputwindow.h @@ -34,6 +34,8 @@ #include <coreplugin/ioutputpane.h> +#include <utils/fileutils.h> + namespace VcsBase { class VcsBaseOutputWindowPrivate; @@ -73,7 +75,7 @@ public: // 'Executing <dir>: <cmd> <args>'. Hides well-known password option // arguments. static QString msgExecutionLogEntry(const QString &workingDir, - const QString &executable, + const Utils::FileName &executable, const QStringList &arguments); enum MessageStyle { @@ -112,7 +114,7 @@ public slots: // Append a standard-formatted entry for command execution // (see msgExecutionLogEntry). void appendCommand(const QString &workingDirectory, - const QString &binary, + const Utils::FileName &binary, const QStringList &args); // Append a blue message text and pop up. diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index 5a4c16ba4c..21fbe06a4f 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -771,7 +771,7 @@ void VcsBasePlugin::setProcessEnvironment(QProcessEnvironment *e, // Run a process synchronously, returning Utils::SynchronousProcessResponse // response struct and using the VcsBasePlugin flags as applicable SynchronousProcessResponse VcsBasePlugin::runVcs(const QString &workingDir, - const QString &binary, + const Utils::FileName &binary, const QStringList &arguments, int timeOutMS, unsigned flags, diff --git a/src/plugins/vcsbase/vcsbaseplugin.h b/src/plugins/vcsbase/vcsbaseplugin.h index bd5c241da0..99ca9eca4f 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.h +++ b/src/plugins/vcsbase/vcsbaseplugin.h @@ -33,6 +33,7 @@ #include "vcsbase_global.h" #include <extensionsystem/iplugin.h> +#include <utils/fileutils.h> #include <QSharedDataPointer> #include <QList> @@ -180,7 +181,7 @@ public: }; static Utils::SynchronousProcessResponse runVcs(const QString &workingDir, - const QString &binary, + const Utils::FileName &binary, const QStringList &arguments, int timeOutMS, unsigned flags = 0, diff --git a/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.cpp b/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.cpp index 2f986a4bd5..2db66cf274 100644 --- a/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.cpp +++ b/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.cpp @@ -99,7 +99,7 @@ SystemPreprocessor::SystemPreprocessor(bool verbose) QMapIterator<QString, QString> i(m_knownCompilers); while (i.hasNext()) { i.next(); - const QString executablePath + const Utils::FileName executablePath = Utils::Environment::systemEnvironment().searchInPath(i.key()); if (!executablePath.isEmpty()) { m_compiler = i.key(); diff --git a/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.pri b/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.pri index 4982a84335..04280c7e69 100644 --- a/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.pri +++ b/src/tools/cplusplus-tools-utils/cplusplus-tools-utils.pri @@ -7,8 +7,14 @@ DEFINES += QTCREATOR_UTILS_STATIC_LIB HEADERS += \ $$PWD/cplusplus-tools-utils.h \ - $$PWD/../../libs/utils/environment.h + $$PWD/../../libs/utils/environment.h \ + $$PWD/../../libs/utils/fileutils.h \ + $$PWD/../../libs/utils/qtcassert.h \ + $$PWD/../../libs/utils/savefile.h SOURCES += \ $$PWD/cplusplus-tools-utils.cpp \ - $$PWD/../../libs/utils/environment.cpp + $$PWD/../../libs/utils/environment.cpp \ + $$PWD/../../libs/utils/fileutils.cpp \ + $$PWD/../../libs/utils/qtcassert.cpp \ + $$PWD/../../libs/utils/savefile.cpp diff --git a/src/tools/qtcreatorcrashhandler/crashhandler.cpp b/src/tools/qtcreatorcrashhandler/crashhandler.cpp index 81f67b365f..e92082809c 100644 --- a/src/tools/qtcreatorcrashhandler/crashhandler.cpp +++ b/src/tools/qtcreatorcrashhandler/crashhandler.cpp @@ -33,6 +33,7 @@ #include "utils.h" #include <utils/environment.h> +#include <utils/fileutils.h> #include <QApplication> #include <QDebug> @@ -94,7 +95,7 @@ public: dialog(crashHandler, signalName) {} const pid_t pid; - const QString creatorInPath; // Backup debugger. + const Utils::FileName creatorInPath; // Backup debugger. BacktraceCollector backtraceCollector; CrashHandlerDialog dialog; @@ -293,7 +294,7 @@ void CrashHandler::debugApplication() } // Prepare command. - QString executable = d->creatorInPath; + QString executable = d->creatorInPath.toString(); if (!d->restartAppCommandLine.isEmpty()) executable = d->restartAppCommandLine.at(0); const QStringList commandLine = QStringList() diff --git a/src/tools/qtcreatorcrashhandler/qtcreatorcrashhandler.pro b/src/tools/qtcreatorcrashhandler/qtcreatorcrashhandler.pro index 9494117135..967c3393c6 100644 --- a/src/tools/qtcreatorcrashhandler/qtcreatorcrashhandler.pro +++ b/src/tools/qtcreatorcrashhandler/qtcreatorcrashhandler.pro @@ -14,7 +14,9 @@ SOURCES += \ utils.cpp \ ../../libs/utils/qtcassert.cpp \ ../../libs/utils/checkablemessagebox.cpp \ - ../../libs/utils/environment.cpp + ../../libs/utils/environment.cpp \ + ../../libs/utils/fileutils.cpp \ + ../../libs/utils/savefile.cpp HEADERS += \ @@ -24,7 +26,9 @@ HEADERS += \ utils.h \ ../../libs/utils/qtcassert.h \ ../../libs/utils/checkablemessagebox.h \ - ../../libs/utils/environment.h + ../../libs/utils/environment.h \ + ../../libs/utils/fileutils.h \ + ../../libs/utils/savefile.h FORMS += \ crashhandlerdialog.ui |