diff --git a/libsearch/searchinterface/searchtasks/file-search-task.cpp b/libsearch/searchinterface/searchtasks/file-search-task.cpp index 3054630..84b7a18 100644 --- a/libsearch/searchinterface/searchtasks/file-search-task.cpp +++ b/libsearch/searchinterface/searchtasks/file-search-task.cpp @@ -365,7 +365,7 @@ bool FileSearchFilter::operator ()(const Xapian::Document &doc) const if (!m_parent->m_validDirectories.empty()) { inSearchDir = std::any_of(m_parent->m_validDirectories.begin(), m_parent->m_validDirectories.end(), [&](QString &dir) { //限制搜索在该目录下 - if (!path.startsWith(dir + "/")) { + if (dir != "/" && !path.startsWith(dir + "/")) { return false; }