forked from qt-creator/qt-creator
FileFinder: FilePathify
Change-Id: I7a4bcb05f85058ddcaf0c69c01b0587116410d95 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -24,16 +24,15 @@ static Q_LOGGING_CATEGORY(finderLog, "qtc.utils.fileinprojectfinder", QtWarningM
|
|||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
static bool checkPath(const QString &candidate, int matchLength,
|
static bool checkPath(const FilePath &candidate, int matchLength,
|
||||||
FileInProjectFinder::FileHandler fileHandler,
|
FileInProjectFinder::FileHandler fileHandler,
|
||||||
FileInProjectFinder::DirectoryHandler directoryHandler)
|
FileInProjectFinder::DirectoryHandler directoryHandler)
|
||||||
{
|
{
|
||||||
const QFileInfo candidateInfo(candidate);
|
if (fileHandler && candidate.isFile()) {
|
||||||
if (fileHandler && candidateInfo.isFile()) {
|
|
||||||
fileHandler(candidate, matchLength);
|
fileHandler(candidate, matchLength);
|
||||||
return true;
|
return true;
|
||||||
} else if (directoryHandler && candidateInfo.isDir()) {
|
} else if (directoryHandler && candidate.isDir()) {
|
||||||
directoryHandler(QDir(candidate).entryList(), matchLength);
|
directoryHandler(QDir(candidate.toFSPathString()).entryList(), matchLength);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -131,16 +130,16 @@ FilePaths FileInProjectFinder::findFile(const QUrl &fileUrl, bool *success) cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString originalPath = fileUrl.toLocalFile();
|
FilePath originalPath = FilePath::fromString(fileUrl.toLocalFile());
|
||||||
if (originalPath.isEmpty()) // e.g. qrc://
|
if (originalPath.isEmpty()) // e.g. qrc://
|
||||||
originalPath = fileUrl.path();
|
originalPath = FilePath::fromString(fileUrl.path());
|
||||||
|
|
||||||
FilePaths result;
|
FilePaths result;
|
||||||
bool found = findFileOrDirectory(originalPath, [&](const QString &fileName, int) {
|
bool found = findFileOrDirectory(originalPath, [&](const FilePath &fileName, int) {
|
||||||
result << FilePath::fromString(fileName);
|
result << fileName;
|
||||||
});
|
});
|
||||||
if (!found)
|
if (!found)
|
||||||
result << FilePath::fromString(originalPath);
|
result << originalPath;
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
*success = found;
|
*success = found;
|
||||||
@@ -148,7 +147,7 @@ FilePaths FileInProjectFinder::findFile(const QUrl &fileUrl, bool *success) cons
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileInProjectFinder::handleSuccess(const QString &originalPath, const QStringList &found,
|
bool FileInProjectFinder::handleSuccess(const FilePath &originalPath, const FilePaths &found,
|
||||||
int matchLength, const char *where) const
|
int matchLength, const char *where) const
|
||||||
{
|
{
|
||||||
qCDebug(finderLog) << "FileInProjectFinder: found" << found << where;
|
qCDebug(finderLog) << "FileInProjectFinder: found" << found << where;
|
||||||
@@ -159,7 +158,7 @@ bool FileInProjectFinder::handleSuccess(const QString &originalPath, const QStri
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileInProjectFinder::findFileOrDirectory(const QString &originalPath, FileHandler fileHandler,
|
bool FileInProjectFinder::findFileOrDirectory(const FilePath &originalPath, FileHandler fileHandler,
|
||||||
DirectoryHandler directoryHandler) const
|
DirectoryHandler directoryHandler) const
|
||||||
{
|
{
|
||||||
if (originalPath.isEmpty()) {
|
if (originalPath.isEmpty()) {
|
||||||
@@ -167,7 +166,7 @@ bool FileInProjectFinder::findFileOrDirectory(const QString &originalPath, FileH
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto segments = originalPath.split('/', Qt::SkipEmptyParts);
|
const auto segments = originalPath.toFSPathString().split('/', Qt::SkipEmptyParts);
|
||||||
const PathMappingNode *node = &m_pathMapRoot;
|
const PathMappingNode *node = &m_pathMapRoot;
|
||||||
for (const auto &segment : segments) {
|
for (const auto &segment : segments) {
|
||||||
auto it = node->children.find(segment);
|
auto it = node->children.find(segment);
|
||||||
@@ -178,12 +177,11 @@ bool FileInProjectFinder::findFileOrDirectory(const QString &originalPath, FileH
|
|||||||
node = *it;
|
node = *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int origLength = originalPath.length();
|
const int origLength = originalPath.toFSPathString().length();
|
||||||
if (node) {
|
if (node) {
|
||||||
if (!node->localPath.isEmpty()) {
|
if (!node->localPath.isEmpty()) {
|
||||||
const QString localPath = node->localPath.toString();
|
if (checkPath(node->localPath, origLength, fileHandler, directoryHandler)) {
|
||||||
if (checkPath(localPath, origLength, fileHandler, directoryHandler)) {
|
return handleSuccess(originalPath, {node->localPath}, origLength,
|
||||||
return handleSuccess(originalPath, QStringList(localPath), origLength,
|
|
||||||
"in mapped paths");
|
"in mapped paths");
|
||||||
}
|
}
|
||||||
} else if (directoryHandler) {
|
} else if (directoryHandler) {
|
||||||
@@ -217,21 +215,21 @@ bool FileInProjectFinder::findFileOrDirectory(const QString &originalPath, FileH
|
|||||||
|
|
||||||
int prefixToIgnore = -1;
|
int prefixToIgnore = -1;
|
||||||
const QChar separator = QLatin1Char('/');
|
const QChar separator = QLatin1Char('/');
|
||||||
if (originalPath.startsWith(m_projectDir.toString() + separator)) {
|
if (originalPath.startsWith(m_projectDir.toFSPathString() + separator)) {
|
||||||
if (HostOsInfo::isMacHost()) {
|
if (originalPath.osType() == OsTypeMac) {
|
||||||
// starting with the project path is not sufficient if the file was
|
// starting with the project path is not sufficient if the file was
|
||||||
// copied in an insource build, e.g. into MyApp.app/Contents/Resources
|
// copied in an insource build, e.g. into MyApp.app/Contents/Resources
|
||||||
static const QString appResourcePath = QString::fromLatin1(".app/Contents/Resources");
|
static const QString appResourcePath = QString::fromLatin1(".app/Contents/Resources");
|
||||||
if (originalPath.contains(appResourcePath)) {
|
if (originalPath.contains(appResourcePath)) {
|
||||||
// the path is inside the project, but most probably as a resource of an insource build
|
// the path is inside the project, but most probably as a resource of an insource build
|
||||||
// so ignore that path
|
// so ignore that path
|
||||||
prefixToIgnore = originalPath.indexOf(appResourcePath) + appResourcePath.length();
|
prefixToIgnore = originalPath.toFSPathString().indexOf(appResourcePath) + appResourcePath.length();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefixToIgnore == -1
|
if (prefixToIgnore == -1
|
||||||
&& checkPath(originalPath, origLength, fileHandler, directoryHandler)) {
|
&& checkPath(originalPath, origLength, fileHandler, directoryHandler)) {
|
||||||
return handleSuccess(originalPath, QStringList(originalPath), origLength,
|
return handleSuccess(originalPath, {originalPath}, origLength,
|
||||||
"in project directory");
|
"in project directory");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -242,24 +240,22 @@ bool FileInProjectFinder::findFileOrDirectory(const QString &originalPath, FileH
|
|||||||
// Strip directories one by one from the beginning of the path,
|
// Strip directories one by one from the beginning of the path,
|
||||||
// and see if the new relative path exists in the build directory.
|
// and see if the new relative path exists in the build directory.
|
||||||
if (prefixToIgnore < 0) {
|
if (prefixToIgnore < 0) {
|
||||||
if (!QFileInfo(originalPath).isAbsolute()
|
if (!originalPath.isAbsolutePath()
|
||||||
&& !originalPath.startsWith(separator)) {
|
&& !originalPath.startsWith(separator)) {
|
||||||
prefixToIgnore = 0;
|
prefixToIgnore = 0;
|
||||||
} else {
|
} else {
|
||||||
prefixToIgnore = originalPath.indexOf(separator);
|
prefixToIgnore = originalPath.toFSPathString().indexOf(separator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (prefixToIgnore != -1) {
|
while (prefixToIgnore != -1) {
|
||||||
QString candidate = originalPath;
|
FilePath candidate = originalPath.resolvePath(m_projectDir);
|
||||||
candidate.remove(0, prefixToIgnore);
|
|
||||||
candidate.prepend(m_projectDir.toString());
|
|
||||||
const int matchLength = origLength - prefixToIgnore;
|
const int matchLength = origLength - prefixToIgnore;
|
||||||
// FIXME: This might be a worse match than what we find later.
|
// FIXME: This might be a worse match than what we find later.
|
||||||
if (checkPath(candidate, matchLength, fileHandler, directoryHandler)) {
|
if (checkPath(candidate, matchLength, fileHandler, directoryHandler)) {
|
||||||
return handleSuccess(originalPath, QStringList(candidate), matchLength,
|
return handleSuccess(originalPath, {candidate}, matchLength,
|
||||||
"in project directory");
|
"in project directory");
|
||||||
}
|
}
|
||||||
prefixToIgnore = originalPath.indexOf(separator, prefixToIgnore + 1);
|
prefixToIgnore = originalPath.toString().indexOf(separator, prefixToIgnore + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,18 +263,19 @@ bool FileInProjectFinder::findFileOrDirectory(const QString &originalPath, FileH
|
|||||||
qCDebug(finderLog) << "FileInProjectFinder: checking project files ...";
|
qCDebug(finderLog) << "FileInProjectFinder: checking project files ...";
|
||||||
|
|
||||||
QStringList matches;
|
QStringList matches;
|
||||||
const QString lastSegment = FilePath::fromString(originalPath).fileName();
|
const QString lastSegment = originalPath.fileName();
|
||||||
if (fileHandler)
|
if (fileHandler)
|
||||||
matches.append(filesWithSameFileName(lastSegment));
|
matches.append(filesWithSameFileName(lastSegment));
|
||||||
if (directoryHandler)
|
if (directoryHandler)
|
||||||
matches.append(pathSegmentsWithSameName(lastSegment));
|
matches.append(pathSegmentsWithSameName(lastSegment));
|
||||||
const QStringList matchedFilePaths = bestMatches(matches, originalPath);
|
|
||||||
|
const QStringList matchedFilePaths = bestMatches(matches, originalPath.toString());
|
||||||
if (!matchedFilePaths.empty()) {
|
if (!matchedFilePaths.empty()) {
|
||||||
const int matchLength = commonPostFixLength(matchedFilePaths.first(), originalPath);
|
const int matchLength = commonPostFixLength(matchedFilePaths.first(), originalPath.toString());
|
||||||
QStringList hits;
|
FilePaths hits;
|
||||||
for (const QString &matchedFilePath : matchedFilePaths) {
|
for (const QString &matchedFilePath : matchedFilePaths) {
|
||||||
if (checkPath(matchedFilePath, matchLength, fileHandler, directoryHandler))
|
if (checkPath(FilePath::fromString(matchedFilePath), matchLength, fileHandler, directoryHandler))
|
||||||
hits << matchedFilePath;
|
hits.append(FilePath::fromString(matchedFilePath));
|
||||||
}
|
}
|
||||||
if (!hits.empty())
|
if (!hits.empty())
|
||||||
return handleSuccess(originalPath, hits, matchLength, "when matching project files");
|
return handleSuccess(originalPath, hits, matchLength, "when matching project files");
|
||||||
@@ -294,10 +291,9 @@ bool FileInProjectFinder::findFileOrDirectory(const QString &originalPath, FileH
|
|||||||
|
|
||||||
// check if absolute path is found in sysroot
|
// check if absolute path is found in sysroot
|
||||||
if (!m_sysroot.isEmpty()) {
|
if (!m_sysroot.isEmpty()) {
|
||||||
const FilePath sysrootPath = m_sysroot.pathAppended(originalPath);
|
const FilePath sysrootPath = m_sysroot.pathAppended(originalPath.toString());
|
||||||
if (checkPath(sysrootPath.toString(), origLength, fileHandler, directoryHandler)) {
|
if (checkPath(sysrootPath, origLength, fileHandler, directoryHandler)) {
|
||||||
return handleSuccess(originalPath, QStringList(sysrootPath.toString()), origLength,
|
return handleSuccess(originalPath, {sysrootPath}, origLength, "in sysroot");
|
||||||
"in sysroot");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,10 +303,10 @@ bool FileInProjectFinder::findFileOrDirectory(const QString &originalPath, FileH
|
|||||||
}
|
}
|
||||||
|
|
||||||
FileInProjectFinder::CacheEntry FileInProjectFinder::findInSearchPaths(
|
FileInProjectFinder::CacheEntry FileInProjectFinder::findInSearchPaths(
|
||||||
const QString &filePath, FileHandler fileHandler, DirectoryHandler directoryHandler) const
|
const FilePath &filePath, FileHandler fileHandler, DirectoryHandler directoryHandler) const
|
||||||
{
|
{
|
||||||
for (const FilePath &dirPath : m_searchDirectories) {
|
for (const FilePath &dirPath : m_searchDirectories) {
|
||||||
const CacheEntry found = findInSearchPath(dirPath.toString(), filePath,
|
const CacheEntry found = findInSearchPath(dirPath, filePath,
|
||||||
fileHandler, directoryHandler);
|
fileHandler, directoryHandler);
|
||||||
if (!found.paths.isEmpty())
|
if (!found.paths.isEmpty())
|
||||||
return found;
|
return found;
|
||||||
@@ -329,15 +325,15 @@ static QString chopFirstDir(const QString &dirPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
FileInProjectFinder::CacheEntry FileInProjectFinder::findInSearchPath(
|
FileInProjectFinder::CacheEntry FileInProjectFinder::findInSearchPath(
|
||||||
const QString &searchPath, const QString &filePath,
|
const FilePath &searchPath, const FilePath &filePath,
|
||||||
FileHandler fileHandler, DirectoryHandler directoryHandler)
|
FileHandler fileHandler, DirectoryHandler directoryHandler)
|
||||||
{
|
{
|
||||||
qCDebug(finderLog) << "FileInProjectFinder: checking search path" << searchPath;
|
qCDebug(finderLog) << "FileInProjectFinder: checking search path" << searchPath;
|
||||||
|
|
||||||
QString s = filePath;
|
QString s = filePath.toFSPathString();
|
||||||
while (!s.isEmpty()) {
|
while (!s.isEmpty()) {
|
||||||
CacheEntry result;
|
CacheEntry result;
|
||||||
result.paths << searchPath + '/' + s;
|
result.paths << searchPath / s;
|
||||||
result.matchLength = s.length() + 1;
|
result.matchLength = s.length() + 1;
|
||||||
qCDebug(finderLog) << "FileInProjectFinder: trying" << result.paths.first();
|
qCDebug(finderLog) << "FileInProjectFinder: trying" << result.paths.first();
|
||||||
|
|
||||||
@@ -346,9 +342,10 @@ FileInProjectFinder::CacheEntry FileInProjectFinder::findInSearchPath(
|
|||||||
|
|
||||||
QString next = chopFirstDir(s);
|
QString next = chopFirstDir(s);
|
||||||
if (next.isEmpty()) {
|
if (next.isEmpty()) {
|
||||||
if (directoryHandler && QFileInfo(searchPath).fileName() == s) {
|
if (directoryHandler && searchPath.fileName() == s) {
|
||||||
result.paths = QStringList{searchPath};
|
result.paths = {searchPath};
|
||||||
directoryHandler(QDir(searchPath).entryList(), result.matchLength);
|
directoryHandler(QDir(searchPath.toFSPathString()).entryList(),
|
||||||
|
result.matchLength);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -19,7 +19,7 @@ class QTCREATOR_UTILS_EXPORT FileInProjectFinder
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using FileHandler = std::function<void(const QString &, int)>;
|
using FileHandler = std::function<void(const FilePath &, int)>;
|
||||||
using DirectoryHandler = std::function<void(const QStringList &, int)>;
|
using DirectoryHandler = std::function<void(const QStringList &, int)>;
|
||||||
|
|
||||||
FileInProjectFinder();
|
FileInProjectFinder();
|
||||||
@@ -34,7 +34,7 @@ public:
|
|||||||
void addMappedPath(const FilePath &localFilePath, const QString &remoteFilePath);
|
void addMappedPath(const FilePath &localFilePath, const QString &remoteFilePath);
|
||||||
|
|
||||||
FilePaths findFile(const QUrl &fileUrl, bool *success = nullptr) const;
|
FilePaths findFile(const QUrl &fileUrl, bool *success = nullptr) const;
|
||||||
bool findFileOrDirectory(const QString &originalPath, FileHandler fileHandler = nullptr,
|
bool findFileOrDirectory(const FilePath &originalPath, FileHandler fileHandler = nullptr,
|
||||||
DirectoryHandler directoryHandler = nullptr) const;
|
DirectoryHandler directoryHandler = nullptr) const;
|
||||||
|
|
||||||
FilePaths searchDirectories() const;
|
FilePaths searchDirectories() const;
|
||||||
@@ -49,7 +49,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct CacheEntry {
|
struct CacheEntry {
|
||||||
QStringList paths;
|
FilePaths paths;
|
||||||
int matchLength = 0;
|
int matchLength = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -63,14 +63,14 @@ private:
|
|||||||
mutable QHash<FilePath, QSharedPointer<QrcParser>> m_parserCache;
|
mutable QHash<FilePath, QSharedPointer<QrcParser>> m_parserCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
CacheEntry findInSearchPaths(const QString &filePath, FileHandler fileHandler,
|
CacheEntry findInSearchPaths(const FilePath &filePath, FileHandler fileHandler,
|
||||||
DirectoryHandler directoryHandler) const;
|
DirectoryHandler directoryHandler) const;
|
||||||
static CacheEntry findInSearchPath(const QString &searchPath, const QString &filePath,
|
static CacheEntry findInSearchPath(const FilePath &searchPath, const FilePath &filePath,
|
||||||
FileHandler fileHandler, DirectoryHandler directoryHandler);
|
FileHandler fileHandler, DirectoryHandler directoryHandler);
|
||||||
QStringList filesWithSameFileName(const QString &fileName) const;
|
QStringList filesWithSameFileName(const QString &fileName) const;
|
||||||
QStringList pathSegmentsWithSameName(const QString &path) const;
|
QStringList pathSegmentsWithSameName(const QString &path) const;
|
||||||
|
|
||||||
bool handleSuccess(const QString &originalPath, const QStringList &found, int confidence,
|
bool handleSuccess(const FilePath &originalPath, const FilePaths &found, int confidence,
|
||||||
const char *where) const;
|
const char *where) const;
|
||||||
|
|
||||||
static int commonPostFixLength(const QString &candidatePath, const QString &filePathToFind);
|
static int commonPostFixLength(const QString &candidatePath, const QString &filePathToFind);
|
||||||
@@ -82,7 +82,7 @@ private:
|
|||||||
FilePaths m_searchDirectories;
|
FilePaths m_searchDirectories;
|
||||||
PathMappingNode m_pathMapRoot;
|
PathMappingNode m_pathMapRoot;
|
||||||
|
|
||||||
mutable QHash<QString, CacheEntry> m_cache;
|
mutable QHash<FilePath, CacheEntry> m_cache;
|
||||||
QrcUrlFinder m_qrcUrlFinder;
|
QrcUrlFinder m_qrcUrlFinder;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1038,6 +1038,15 @@ bool FilePath::endsWith(const QString &s) const
|
|||||||
return pathView().endsWith(s, caseSensitivity());
|
return pathView().endsWith(s, caseSensitivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \param s The string to check for contains.
|
||||||
|
* \returns whether FilePath contains \a s
|
||||||
|
*/
|
||||||
|
bool FilePath::contains(const QString &s) const
|
||||||
|
{
|
||||||
|
return pathView().contains(s, caseSensitivity());
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Checks whether the FilePath starts with a drive letter.
|
* \brief Checks whether the FilePath starts with a drive letter.
|
||||||
* Defaults to \c false if it is a non-Windows host or represents a path on device
|
* Defaults to \c false if it is a non-Windows host or represents a path on device
|
||||||
|
@@ -94,6 +94,7 @@ public:
|
|||||||
[[nodiscard]] FilePath stringAppended(const QString &str) const;
|
[[nodiscard]] FilePath stringAppended(const QString &str) const;
|
||||||
bool startsWith(const QString &s) const;
|
bool startsWith(const QString &s) const;
|
||||||
bool endsWith(const QString &s) const;
|
bool endsWith(const QString &s) const;
|
||||||
|
bool contains(const QString &s) const;
|
||||||
|
|
||||||
bool exists() const;
|
bool exists() const;
|
||||||
|
|
||||||
|
@@ -146,16 +146,20 @@ void QmlPreviewConnectionManager::createPreviewClient()
|
|||||||
connect(this, &QmlPreviewConnectionManager::zoom,
|
connect(this, &QmlPreviewConnectionManager::zoom,
|
||||||
m_qmlPreviewClient.data(), &QmlPreviewClient::zoom);
|
m_qmlPreviewClient.data(), &QmlPreviewClient::zoom);
|
||||||
|
|
||||||
connect(m_qmlPreviewClient.data(), &QmlPreviewClient::pathRequested,
|
connect(m_qmlPreviewClient.data(),
|
||||||
this, [this](const QString &path) {
|
&QmlPreviewClient::pathRequested,
|
||||||
|
this,
|
||||||
|
[this](const QString &path) {
|
||||||
const bool found = m_projectFileFinder.findFileOrDirectory(
|
const bool found = m_projectFileFinder.findFileOrDirectory(
|
||||||
path, [&](const QString &filename, int confidence) {
|
Utils::FilePath::fromString(path),
|
||||||
|
[&](const Utils::FilePath &filename, int confidence) {
|
||||||
if (m_fileLoader && confidence == path.length()) {
|
if (m_fileLoader && confidence == path.length()) {
|
||||||
bool success = false;
|
bool success = false;
|
||||||
QByteArray contents = m_fileLoader(filename, &success);
|
QByteArray contents = m_fileLoader(filename.toFSPathString(), &success);
|
||||||
if (success) {
|
if (success) {
|
||||||
if (!m_fileSystemWatcher.watchesFile(filename)) {
|
if (!m_fileSystemWatcher.watchesFile(filename.toFSPathString())) {
|
||||||
m_fileSystemWatcher.addFile(filename,
|
m_fileSystemWatcher
|
||||||
|
.addFile(filename.toFSPathString(),
|
||||||
Utils::FileSystemWatcher::WatchModifiedDate);
|
Utils::FileSystemWatcher::WatchModifiedDate);
|
||||||
}
|
}
|
||||||
m_qmlPreviewClient->announceFile(path, contents);
|
m_qmlPreviewClient->announceFile(path, contents);
|
||||||
@@ -165,7 +169,8 @@ void QmlPreviewConnectionManager::createPreviewClient()
|
|||||||
} else {
|
} else {
|
||||||
m_qmlPreviewClient->announceError(path);
|
m_qmlPreviewClient->announceError(path);
|
||||||
}
|
}
|
||||||
}, [&](const QStringList &entries, int confidence) {
|
},
|
||||||
|
[&](const QStringList &entries, int confidence) {
|
||||||
if (confidence == path.length())
|
if (confidence == path.length())
|
||||||
m_qmlPreviewClient->announceDirectory(path, entries);
|
m_qmlPreviewClient->announceDirectory(path, entries);
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user