diff options
Diffstat (limited to 'src/shared')
| -rw-r--r-- | src/shared/directoryentry.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp index 01c325ef..6351083b 100644 --- a/src/shared/directoryentry.cpp +++ b/src/shared/directoryentry.cpp @@ -24,6 +24,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "originconnection.h" #include "util.h" #include "windows_error.h" +#include <filesystem> #include <log.h> #include <utility.h> @@ -630,19 +631,21 @@ void DirectoryEntry::addFiles(env::DirectoryWalker& walker, FilesOrigin& origin, Context cx = {origin, stats}; cx.current.push(this); - walker.forEachEntry( - path, &cx, - [](void* pcx, std::wstring_view path) { - onDirectoryStart((Context*)pcx, path); - }, + if (std::filesystem::exists(path)) { + walker.forEachEntry( + path, &cx, + [](void* pcx, std::wstring_view path) { + onDirectoryStart((Context*)pcx, path); + }, - [](void* pcx, std::wstring_view path) { - onDirectoryEnd((Context*)pcx, path); - }, + [](void* pcx, std::wstring_view path) { + onDirectoryEnd((Context*)pcx, path); + }, - [](void* pcx, std::wstring_view path, FILETIME ft, uint64_t) { - onFile((Context*)pcx, path, ft); - }); + [](void* pcx, std::wstring_view path, FILETIME ft, uint64_t) { + onFile((Context*)pcx, path, ft); + }); + } } void DirectoryEntry::onDirectoryStart(Context* cx, std::wstring_view path) |
