forked from qt-creator/qt-creator
Debugger: Remove some uses of FilePath::toFileInfo()
Change-Id: I78037741084630fc6852f5805595ec2943db64d2 Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -143,31 +143,22 @@ void DebuggerItem::createId()
|
||||
m_id = QUuid::createUuid().toString();
|
||||
}
|
||||
|
||||
static bool isUVisionExecutable(const QFileInfo &fileInfo)
|
||||
{
|
||||
if (!HostOsInfo::isWindowsHost())
|
||||
return false;
|
||||
const QString baseName = fileInfo.baseName();
|
||||
return baseName == "UV4";
|
||||
}
|
||||
|
||||
void DebuggerItem::reinitializeFromFile(const Environment &sysEnv, QString *error)
|
||||
{
|
||||
// CDB only understands the single-dash -version, whereas GDB and LLDB are
|
||||
// happy with both -version and --version. So use the "working" -version
|
||||
// except for the experimental LLDB-MI which insists on --version.
|
||||
QString version = "-version";
|
||||
const QFileInfo fileInfo = m_command.toFileInfo();
|
||||
m_lastModified = fileInfo.lastModified();
|
||||
if (fileInfo.baseName().toLower().contains("lldb-mi"))
|
||||
m_lastModified = m_command.lastModified();
|
||||
if (m_command.baseName().toLower().contains("lldb-mi"))
|
||||
version = "--version";
|
||||
|
||||
// We don't need to start the uVision executable to
|
||||
// determine its version.
|
||||
if (isUVisionExecutable(fileInfo)) {
|
||||
if (HostOsInfo::isWindowsHost() && m_command.baseName() == "UV4") {
|
||||
QString errorMessage;
|
||||
m_version = winGetDLLVersion(WinDLLFileVersion,
|
||||
fileInfo.absoluteFilePath(),
|
||||
m_command.absoluteFilePath().path(),
|
||||
&errorMessage);
|
||||
m_engineType = UvscEngineType;
|
||||
m_abis.clear();
|
||||
@@ -179,7 +170,7 @@ void DebuggerItem::reinitializeFromFile(const Environment &sysEnv, QString *erro
|
||||
if (HostOsInfo::isWindowsHost() && m_command.fileName().startsWith("lldb")) {
|
||||
QString errorMessage;
|
||||
m_version = winGetDLLVersion(WinDLLFileVersion,
|
||||
fileInfo.absoluteFilePath(),
|
||||
m_command.absoluteFilePath().path(),
|
||||
&errorMessage);
|
||||
m_engineType = LldbEngineType;
|
||||
m_abis = Abi::abisOfBinary(m_command);
|
||||
@@ -305,7 +296,7 @@ QIcon DebuggerItem::decoration() const
|
||||
{
|
||||
if (m_engineType == NoEngineType)
|
||||
return Icons::CRITICAL.icon();
|
||||
if (!m_command.toFileInfo().isExecutable())
|
||||
if (!m_command.isExecutableFile())
|
||||
return Icons::WARNING.icon();
|
||||
if (!m_workingDirectory.isEmpty() && !m_workingDirectory.isDir())
|
||||
return Icons::WARNING.icon();
|
||||
|
@@ -938,7 +938,7 @@ void DebuggerItemManagerPrivate::readDebuggers(const FilePath &fileName, bool is
|
||||
.arg(item.command().toUserOutput(), item.id().toString(), fileName.toUserOutput());
|
||||
continue;
|
||||
}
|
||||
if (!item.command().toFileInfo().isExecutable()) {
|
||||
if (!item.command().isExecutableFile()) {
|
||||
qWarning() << QString("DebuggerItem \"%1\" (%2) read from \"%3\" dropped since the command is not executable.")
|
||||
.arg(item.command().toUserOutput(), item.id().toString(), fileName.toUserOutput());
|
||||
continue;
|
||||
|
@@ -307,10 +307,10 @@ DebuggerKitAspect::ConfigurationErrors DebuggerKitAspect::configurationErrors(co
|
||||
return NoDebugger;
|
||||
|
||||
ConfigurationErrors result = NoConfigurationError;
|
||||
const QFileInfo fi = item->command().toFileInfo();
|
||||
if (!fi.exists() || fi.isDir())
|
||||
const FilePath debugger = item->command();
|
||||
if (!debugger.exists() || debugger.isDir())
|
||||
result |= DebuggerNotFound;
|
||||
else if (!fi.isExecutable())
|
||||
else if (!debugger.isExecutableFile())
|
||||
result |= DebuggerNotExecutable;
|
||||
|
||||
const Abi tcAbi = ToolChainKitAspect::targetAbi(k);
|
||||
@@ -321,13 +321,13 @@ DebuggerKitAspect::ConfigurationErrors DebuggerKitAspect::configurationErrors(co
|
||||
result |= DebuggerDoesNotMatch;
|
||||
}
|
||||
|
||||
if (!fi.exists() || fi.isDir()) {
|
||||
if (!debugger.exists() || debugger.isDir()) {
|
||||
if (item->engineType() == NoEngineType)
|
||||
return NoDebugger;
|
||||
|
||||
// We need an absolute path to be able to locate Python on Windows.
|
||||
if (item->engineType() == GdbEngineType) {
|
||||
if (tcAbi.os() == Abi::WindowsOS && !fi.isAbsolute())
|
||||
if (tcAbi.os() == Abi::WindowsOS && !debugger.isAbsolutePath())
|
||||
result |= DebuggerNeedsAbsolutePath;
|
||||
}
|
||||
}
|
||||
|
@@ -68,7 +68,7 @@ constexpr int kRootStackFrameLevel = 1;
|
||||
static void allowRootLocals(const FilePath &projectFile)
|
||||
{
|
||||
const QFileInfo fi(projectFile.toFileInfo());
|
||||
if (!fi.exists())
|
||||
if (!projectFile.exists())
|
||||
return;
|
||||
const QString baseName = fi.baseName();
|
||||
const QDir dir(fi.dir());
|
||||
|
Reference in New Issue
Block a user