Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/elfmz/far2l.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelfmz <fenix1905@tut.by>2022-10-24 22:42:29 +0300
committerelfmz <fenix1905@tut.by>2022-10-24 22:42:29 +0300
commit2aa62de1fe4bd65858bf62b981b765ffdc3d6a6d (patch)
treedb1154681a41829163694103874806fe0515eddd
parent83a268c783d50999c6b3e95fcdb9301e0b1a2288 (diff)
fix find file from the root (fix #1371)
-rw-r--r--far2l/src/scantree.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/far2l/src/scantree.cpp b/far2l/src/scantree.cpp
index b30ac422..0213ccae 100644
--- a/far2l/src/scantree.cpp
+++ b/far2l/src/scantree.cpp
@@ -55,10 +55,13 @@ void ScanTree::SetFindPath(const wchar_t *Path,const wchar_t *Mask, const DWORD
strFindMask = wcscmp(Mask, L"*") ? Mask : L"";
ScanDirStack.clear();
- DeleteEndSlash(strFindPath);
+ if (strFindPath != L"/") {
+ DeleteEndSlash(strFindPath);
+ }
ScanDirStack.emplace_back();
ConvertNameToReal(strFindPath.c_str(), ScanDirStack.back().RealPath);
+
StartEnumSubdir();
}
@@ -131,8 +134,9 @@ void ScanTree::LeaveSubdir()
{
ScanDirStack.pop_back();
size_t p = strFindPath.rfind('/', strFindPath.size() - 2);
- if (p != std::string::npos && p > 0)
+ if (p != std::string::npos) {
strFindPath.resize(p + 1);
+ }
} else
fprintf(stderr, "ScanTree::LeaveSubdir() invoked on empty stack!\n");