diff --git a/src/plugins/baremetal/iarewparser.cpp b/src/plugins/baremetal/iarewparser.cpp index 92e38736560..66a7317618d 100644 --- a/src/plugins/baremetal/iarewparser.cpp +++ b/src/plugins/baremetal/iarewparser.cpp @@ -97,7 +97,7 @@ void IarParser::amendFilePath() QString filePath; while (!m_filePathParts.isEmpty()) filePath.append(m_filePathParts.takeFirst().trimmed()); - m_lastTask.file = Utils::FileName::fromUserInput(filePath); + m_lastTask.setFile(Utils::FileName::fromUserInput(filePath)); m_expectFilePath = false; } diff --git a/src/plugins/projectexplorer/task.cpp b/src/plugins/projectexplorer/task.cpp index 4d334a78e8a..98602713297 100644 --- a/src/plugins/projectexplorer/task.cpp +++ b/src/plugins/projectexplorer/task.cpp @@ -65,17 +65,11 @@ Task::Task(TaskType type_, const QString &description_, const Utils::FileName &file_, int line_, Core::Id category_, const QIcon &icon, Options options) : taskId(s_nextId), type(type_), options(options), description(description_), - file(file_), line(line_), movedLine(line_), category(category_), + line(line_), movedLine(line_), category(category_), icon(icon.isNull() ? taskTypeIcon(type_) : icon) { ++s_nextId; - if (!file.isEmpty() && !file.toFileInfo().isAbsolute()) { - Utils::FileNameList possiblePaths = Internal::findFileInSession(file); - if (possiblePaths.length() == 1) - file = possiblePaths.first(); - else - fileCandidates = possiblePaths; - } + setFile(file_); } Task Task::compilerMissingTask() @@ -126,6 +120,18 @@ void Task::clear() m_mark.clear(); } +void Task::setFile(const Utils::FileName &file_) +{ + file = file_; + if (!file.isEmpty() && !file.toFileInfo().isAbsolute()) { + Utils::FileNameList possiblePaths = Internal::findFileInSession(file); + if (possiblePaths.length() == 1) + file = possiblePaths.first(); + else + fileCandidates = possiblePaths; + } +} + // // functions // diff --git a/src/plugins/projectexplorer/task.h b/src/plugins/projectexplorer/task.h index b8b80784aa4..82ff6fcb135 100644 --- a/src/plugins/projectexplorer/task.h +++ b/src/plugins/projectexplorer/task.h @@ -70,6 +70,7 @@ public: bool isNull() const; void clear(); + void setFile(const Utils::FileName &file); unsigned int taskId = 0; TaskType type = Unknown;