ProjectExplorer: Export findFileInSession()

Would be useful for https://github.com/JakeSays/QtCreatorTerminalPlugin/

Change-Id: I6629c95535b5ce7af8f9d486005f41598b8dff47
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-11-04 09:10:35 +01:00
parent e7144e4883
commit ac37146e27
3 changed files with 8 additions and 6 deletions

View File

@@ -79,11 +79,12 @@ FilePathList FileInSessionFinder::doFindFile(const FilePath &filePath)
return m_finder.findFile(QUrl::fromLocalFile(filePath.toString()));
}
} // namespace Internal
FilePathList findFileInSession(const FilePath &filePath)
{
static FileInSessionFinder finder;
static Internal::FileInSessionFinder finder;
return finder.doFindFile(filePath);
}
} // namespace Internal
} // namespace ProjectExplorer

View File

@@ -25,12 +25,13 @@
#pragma once
#include "projectexplorer_export.h"
#include <utils/fileutils.h>
namespace ProjectExplorer {
namespace Internal {
Utils::FilePathList findFileInSession(const Utils::FilePath &filePath);
// Possibly used by "QtCreatorTerminalPlugin"
PROJECTEXPLORER_EXPORT Utils::FilePathList findFileInSession(const Utils::FilePath &filePath);
} // namespace Internal
} // namespace ProjectExplorer

View File

@@ -124,7 +124,7 @@ void Task::setFile(const Utils::FilePath &file_)
{
file = file_;
if (!file.isEmpty() && !file.toFileInfo().isAbsolute()) {
Utils::FilePathList possiblePaths = Internal::findFileInSession(file);
Utils::FilePathList possiblePaths = findFileInSession(file);
if (possiblePaths.length() == 1)
file = possiblePaths.first();
else