From 04c1d298282ef670cf7762ad6f97a081f26030bf Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 16 Aug 2021 09:20:36 +0200 Subject: [PATCH] Valgrind: some more FilePath in heob code Change-Id: I53603b1a984bedd0a9d04aab9f6fbc38d9feee21 Reviewed-by: Christian Stenger --- src/plugins/valgrind/memchecktool.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 366b3dc1789..e243156d842 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -751,7 +751,7 @@ void MemcheckToolPrivate::heobAction() return; } - QString executable = sr.command.executable().toString(); + FilePath executable = sr.command.executable(); const QString workingDirectory = Utils::FileUtils::normalizePathName(sr.workingDirectory.toString()); const QString commandLineArguments = sr.command.arguments(); const QStringList envStrings = sr.environment.toStringList(); @@ -763,10 +763,10 @@ void MemcheckToolPrivate::heobAction() TaskHub::requestPopup(); return; } - if (!QFile::exists(executable)) - executable = Utils::HostOsInfo::withExecutableSuffix(executable); - if (!QFile::exists(executable)) { - const QString msg = MemcheckTool::tr("Heob: Cannot find %1.").arg(executable); + if (!executable.exists()) + executable = executable.withExecutableSuffix(); + if (!executable.exists()) { + const QString msg = MemcheckTool::tr("Heob: Cannot find %1.").arg(executable.toUserOutput()); TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID); TaskHub::requestPopup(); return; @@ -774,8 +774,11 @@ void MemcheckToolPrivate::heobAction() // make executable a relative path if possible const QString wdSlashed = workingDirectory + '/'; - if (executable.startsWith(wdSlashed, Qt::CaseInsensitive)) - executable.remove(0, wdSlashed.size()); + QString executablePath = executable.path(); + if (executablePath.startsWith(wdSlashed, Qt::CaseInsensitive)) { + executablePath.remove(0, wdSlashed.size()); + executable.setPath(executablePath); + } // heob arguments HeobDialog dialog(Core::ICore::dialogParent()); @@ -822,7 +825,7 @@ void MemcheckToolPrivate::heobAction() QFile::remove(xmlPath); // full command line - QString arguments = heob + heobArguments + " \"" + executable + '\"'; + QString arguments = heob + heobArguments + " \"" + executable.path() + '\"'; if (!commandLineArguments.isEmpty()) arguments += ' ' + commandLineArguments; QByteArray argumentsCopy(reinterpret_cast(arguments.utf16()), arguments.size() * 2 + 2);