From 99d87ea638f71b53b08b8028c9952f75c06b69cf Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 10 Dec 2024 00:03:55 +0100 Subject: Core/Commands: Fix vmap directory size calculation for .server debug command after 518fe1fd1ecf107e11336c4a41ed90405b115dc0 --- src/server/scripts/Commands/cs_server.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp index c58f038677a..c9221d3ff90 100644 --- a/src/server/scripts/Commands/cs_server.cpp +++ b/src/server/scripts/Commands/cs_server.cpp @@ -204,12 +204,12 @@ public: continue; } - auto end = boost::filesystem::directory_iterator(); - std::size_t folderSize = std::accumulate(boost::filesystem::directory_iterator(mapPath), end, std::size_t(0), [](std::size_t val, boost::filesystem::path const& mapFile) + auto end = boost::filesystem::recursive_directory_iterator(); + std::size_t folderSize = std::accumulate(boost::filesystem::recursive_directory_iterator(mapPath), end, std::size_t(0), [](std::size_t val, boost::filesystem::directory_entry const& mapFile) { boost::system::error_code ec; - if (boost::filesystem::is_regular_file(mapFile, ec)) - val += boost::filesystem::file_size(mapFile); + if (mapFile.is_regular_file(ec) && !ec) + val += boost::filesystem::file_size(mapFile.path(), ec); return val; }); -- cgit v1.2.3