From a339b337ebd3cef27fb8664e8a58f5534ee227cb Mon Sep 17 00:00:00 2001 From: iaom Date: Fri, 7 Apr 2023 10:20:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=90=9C=E7=B4=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=BD=93=E8=AE=BE=E7=BD=AE=E6=90=9C=E7=B4=A2=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E4=B8=BA=E2=80=98/=E2=80=99=E6=97=B6=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=90=9C=E5=88=B0=E5=86=85=E5=AE=B9=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../searchinterface/searchtasks/file-content-search-task.cpp | 2 +- libsearch/searchinterface/searchtasks/file-search-task.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libsearch/searchinterface/searchtasks/file-content-search-task.cpp b/libsearch/searchinterface/searchtasks/file-content-search-task.cpp index c447e62..646b2bd 100644 --- a/libsearch/searchinterface/searchtasks/file-content-search-task.cpp +++ b/libsearch/searchinterface/searchtasks/file-content-search-task.cpp @@ -94,7 +94,7 @@ void FileContentSearchWorker::run() searchDirs.removeDuplicates(); for (QString &dir : searchDirs) { - if (dir.endsWith("/")) { + if (dir.endsWith("/") && dir != "/") { dir = dir.mid(0, dir.length() - 1); } diff --git a/libsearch/searchinterface/searchtasks/file-search-task.cpp b/libsearch/searchinterface/searchtasks/file-search-task.cpp index e068a63..c1fa75a 100644 --- a/libsearch/searchinterface/searchtasks/file-search-task.cpp +++ b/libsearch/searchinterface/searchtasks/file-search-task.cpp @@ -73,7 +73,7 @@ void FileSearchWorker::run() for (QString &dir : searchDirs) { if (QFileInfo::exists(dir)) { - if (dir.endsWith("/")) { + if (dir.endsWith("/") && dir != "/") { dir.remove(dir.length() - 1, 1); }