diff --git a/src/libs/utils/fileinprojectfinder.cpp b/src/libs/utils/fileinprojectfinder.cpp index 98d8d748c1e..be0a20ca8a6 100644 --- a/src/libs/utils/fileinprojectfinder.cpp +++ b/src/libs/utils/fileinprojectfinder.cpp @@ -102,16 +102,12 @@ void FileInProjectFinder::setProjectFiles(const FileNameList &projectFiles) m_cache.clear(); } -void FileInProjectFinder::setSysroot(const QString &sysroot) +void FileInProjectFinder::setSysroot(const FileName &sysroot) { - QString newsys = sysroot; - while (newsys.endsWith(QLatin1Char('/'))) - newsys.remove(newsys.length() - 1, 1); - - if (m_sysroot == newsys) + if (m_sysroot == sysroot) return; - m_sysroot = newsys; + m_sysroot = sysroot; m_cache.clear(); } @@ -274,9 +270,10 @@ bool FileInProjectFinder::findFileOrDirectory(const QString &originalPath, FileH // check if absolute path is found in sysroot if (!m_sysroot.isEmpty()) { - const QString sysrootPath = m_sysroot + originalPath; - if (checkPath(sysrootPath, fileHandler, directoryHandler)) - return handleSuccess(originalPath, sysrootPath, "in sysroot"); + FileName sysrootPath = m_sysroot; + sysrootPath.appendPath(originalPath); + if (checkPath(sysrootPath.toString(), fileHandler, directoryHandler)) + return handleSuccess(originalPath, sysrootPath.toString(), "in sysroot"); } qCDebug(finderLog) << "FileInProjectFinder: couldn't find file!"; diff --git a/src/libs/utils/fileinprojectfinder.h b/src/libs/utils/fileinprojectfinder.h index 409a353601f..d35f509c622 100644 --- a/src/libs/utils/fileinprojectfinder.h +++ b/src/libs/utils/fileinprojectfinder.h @@ -48,7 +48,7 @@ public: FileName projectDirectory() const; void setProjectFiles(const FileNameList &projectFiles); - void setSysroot(const QString &sysroot); + void setSysroot(const FileName &sysroot); void addMappedPath(const FileName &localFilePath, const QString &remoteFilePath); @@ -80,7 +80,7 @@ private: static QString bestMatch(const QStringList &filePaths, const QString &filePathToFind); FileName m_projectDir; - QString m_sysroot; + FileName m_sysroot; FileNameList m_projectFiles; FileNameList m_searchDirectories; PathMappingNode m_pathMapRoot; diff --git a/src/plugins/android/androiddebugsupport.cpp b/src/plugins/android/androiddebugsupport.cpp index d23fc797d22..9636c68ac7a 100644 --- a/src/plugins/android/androiddebugsupport.cpp +++ b/src/plugins/android/androiddebugsupport.cpp @@ -147,9 +147,10 @@ void AndroidDebugSupport::start() gdbServer.setPort(m_runner->gdbServerPort().number()); setRemoteChannel(gdbServer); - QString sysRoot = AndroidConfigurations::currentConfig().ndkLocation().appendPath("platforms") + Utils::FileName sysRoot = AndroidConfigurations::currentConfig().ndkLocation() + .appendPath("platforms") .appendPath(QString("android-%1").arg(AndroidManager::minimumSDK(target))) - .appendPath(toNdkArch(AndroidManager::targetArch(target))).toString(); + .appendPath(toNdkArch(AndroidManager::targetArch(target))); setSysRoot(sysRoot); qCDebug(androidDebugSupportLog) << "Sysroot: " << sysRoot; } diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index b04b7bd794f..c2d860bd21b 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -122,7 +122,7 @@ public: QString platform; QString deviceSymbolsRoot; bool continueAfterAttach = false; - QString sysRoot; + Utils::FileName sysRoot; // Used by general core file debugging. Public access requested in QTCREATORBUG-17158. QString coreFile; diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 062bb93cc81..e9902f0b3a4 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -308,7 +308,7 @@ void DebuggerRunTool::setAttachPid(qint64 pid) m_runParameters.attachPID = ProcessHandle(pid); } -void DebuggerRunTool::setSysRoot(const QString &sysRoot) +void DebuggerRunTool::setSysRoot(const Utils::FileName &sysRoot) { m_runParameters.sysRoot = sysRoot; } @@ -811,7 +811,7 @@ bool DebuggerRunTool::fixupParameters() } if (!boolSetting(AutoEnrichParameters)) { - const QString sysroot = rp.sysRoot; + const QString sysroot = rp.sysRoot.toString(); if (rp.debugInfoLocation.isEmpty()) rp.debugInfoLocation = sysroot + "/usr/lib/debug"; if (rp.debugSourceLocation.isEmpty()) { @@ -905,7 +905,7 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, Kit *kit, bool allowTer kit = runConfig->target()->kit(); QTC_ASSERT(kit, return); - m_runParameters.sysRoot = SysRootKitInformation::sysRoot(kit).toString(); + m_runParameters.sysRoot = SysRootKitInformation::sysRoot(kit); m_runParameters.macroExpander = kit->macroExpander(); m_runParameters.debugger = DebuggerKitInformation::runnable(kit); m_runParameters.cppEngineType = DebuggerKitInformation::engineType(kit); @@ -976,7 +976,7 @@ void DebuggerRunTool::startRunControl() void DebuggerRunTool::addSolibSearchDir(const QString &str) { QString path = str; - path.replace("%{sysroot}", m_runParameters.sysRoot); + path.replace("%{sysroot}", m_runParameters.sysRoot.toString()); m_runParameters.solibSearchPath.append(path); } diff --git a/src/plugins/debugger/debuggerruncontrol.h b/src/plugins/debugger/debuggerruncontrol.h index abf45225cb0..23d2a5e0305 100644 --- a/src/plugins/debugger/debuggerruncontrol.h +++ b/src/plugins/debugger/debuggerruncontrol.h @@ -94,7 +94,7 @@ public: void setAttachPid(Utils::ProcessHandle pid); void setAttachPid(qint64 pid); - void setSysRoot(const QString &sysRoot); + void setSysRoot(const Utils::FileName &sysRoot); void setSymbolFile(const QString &symbolFile); void setRemoteChannel(const QString &channel); void setRemoteChannel(const QString &host, int port); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index fe64936e929..52a6f9a4b3a 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1615,7 +1615,7 @@ QString GdbEngine::cleanupFullName(const QString &fileName) if (!boolSetting(AutoEnrichParameters)) return cleanFilePath; - const QString sysroot = runParameters().sysRoot; + const QString sysroot = runParameters().sysRoot.toString(); if (QFileInfo(cleanFilePath).isReadable()) return cleanFilePath; if (!sysroot.isEmpty() && fileName.startsWith('/')) { @@ -3701,10 +3701,10 @@ void GdbEngine::setupEngine() } if (!rp.sysRoot.isEmpty()) { - runCommand({"set sysroot " + rp.sysRoot}); + runCommand({"set sysroot " + rp.sysRoot.toString()}); // sysroot is not enough to correctly locate the sources, so explicitly // relocate the most likely place for the debug source - runCommand({"set substitute-path /usr/src " + rp.sysRoot + "/usr/src"}); + runCommand({"set substitute-path /usr/src " + rp.sysRoot.toString() + "/usr/src"}); } //QByteArray ba = QFileInfo(sp.dumperLibrary).path().toLocal8Bit(); diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 3e5b88d5187..a01c25559fb 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -284,7 +284,8 @@ void LldbEngine::setupEngine() QTC_CHECK(!rp.attachPID.isValid() || (rp.startMode == AttachCrashedExternal || rp.startMode == AttachExternal)); cmd2.arg("attachpid", rp.attachPID.pid()); - cmd2.arg("sysroot", rp.deviceSymbolsRoot.isEmpty() ? rp.sysRoot : rp.deviceSymbolsRoot); + cmd2.arg("sysroot", rp.deviceSymbolsRoot.isEmpty() ? rp.sysRoot.toString() + : rp.deviceSymbolsRoot); cmd2.arg("remotechannel", ((rp.startMode == AttachToRemoteProcess || rp.startMode == AttachToRemoteServer) ? rp.remoteChannel : QString())); diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp index 30f569b8265..bb69ba46472 100644 --- a/src/plugins/qnx/qnxdebugsupport.cpp +++ b/src/plugins/qnx/qnxdebugsupport.cpp @@ -85,8 +85,10 @@ static QStringList searchPaths(Kit *kit) searchPaths << qtVersion->qmakeProperty("QT_INSTALL_PLUGINS") + '/' + dir; searchPaths << qtVersion->qmakeProperty("QT_INSTALL_LIBS"); - searchPaths << qtVersion->qnxTarget() + '/' + qtVersion->cpuDir() + "/lib"; - searchPaths << qtVersion->qnxTarget() + '/' + qtVersion->cpuDir() + "/usr/lib"; + searchPaths << qtVersion->qnxTarget().appendPath(qtVersion->cpuDir()).appendPath("lib") + .toString(); + searchPaths << qtVersion->qnxTarget().appendPath(qtVersion->cpuDir()).appendPath("usr/lib") + .toString(); return searchPaths; } diff --git a/src/plugins/qnx/qnxqtversion.cpp b/src/plugins/qnx/qnxqtversion.cpp index 950cd9b1e54..3a49afa765b 100644 --- a/src/plugins/qnx/qnxqtversion.cpp +++ b/src/plugins/qnx/qnxqtversion.cpp @@ -98,17 +98,17 @@ QString QnxQtVersion::qnxHost() const return QString(); } -QString QnxQtVersion::qnxTarget() const +Utils::FileName QnxQtVersion::qnxTarget() const { if (!m_environmentUpToDate) updateEnvironment(); foreach (const Utils::EnvironmentItem &item, m_qnxEnv) { if (item.name == QLatin1String(Constants::QNX_TARGET_KEY)) - return item.value; + return Utils::FileName::fromUserInput(item.value); } - return QString(); + return Utils::FileName(); } QString QnxQtVersion::cpuDir() const diff --git a/src/plugins/qnx/qnxqtversion.h b/src/plugins/qnx/qnxqtversion.h index e67bc6bfb20..6bea0ed4b1d 100644 --- a/src/plugins/qnx/qnxqtversion.h +++ b/src/plugins/qnx/qnxqtversion.h @@ -52,7 +52,7 @@ public: QSet targetDeviceTypes() const override; QString qnxHost() const; - QString qnxTarget() const; + Utils::FileName qnxTarget() const; QString cpuDir() const; diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index ae3bf0c93d3..398ba3bf135 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -1354,7 +1354,7 @@ void BaseQtVersion::populateQmlFileFinder(FileInProjectFinder *finder, const Tar // ... and find the sysroot and qml directory if we have any target at all. const ProjectExplorer::Kit *kit = target ? target->kit() : nullptr; - QString activeSysroot = ProjectExplorer::SysRootKitInformation::sysRoot(kit).toString(); + const Utils::FileName activeSysroot = ProjectExplorer::SysRootKitInformation::sysRoot(kit); const QtSupport::BaseQtVersion *qtVersion = QtVersionManager::isLoaded() ? QtSupport::QtKitInformation::qtVersion(kit) : nullptr; Utils::FileNameList additionalSearchDirectories = qtVersion