From 1ae21c423fac58e6948e77c36b8d02d2505b1050 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Thu, 19 Dec 2024 10:19:41 -0800 Subject: [PATCH] skip non-files (#1690) --- dCommon/GeneralUtils.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dCommon/GeneralUtils.cpp b/dCommon/GeneralUtils.cpp index 52287904..34d0aefb 100644 --- a/dCommon/GeneralUtils.cpp +++ b/dCommon/GeneralUtils.cpp @@ -291,11 +291,12 @@ std::u16string GeneralUtils::ReadWString(RakNet::BitStream& inStream) { std::vector GeneralUtils::GetSqlFileNamesFromFolder(const std::string_view folder) { // Because we dont know how large the initial number before the first _ is we need to make it a map like so. - std::map filenames{}; + std::map filenames{}; for (const auto& t : std::filesystem::directory_iterator(folder)) { - auto filename = t.path().filename().string(); - const auto index = std::stoi(GeneralUtils::SplitString(filename, '_').at(0)); - filenames.emplace(index, std::move(filename)); + if (t.is_directory() || t.is_symlink()) continue; + auto filename = t.path().filename().string(); + const auto index = std::stoi(GeneralUtils::SplitString(filename, '_').at(0)); + filenames.emplace(index, std::move(filename)); } // Now sort the map by the oldest migration.