MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / DirSizeBytes

Function DirSizeBytes

engine/Poseidon/Core/ModCollection.cpp:50–64  ·  view source on GitHub ↗

Total size of every regular file under dir (recursive). Best-effort: I/O errors stop the walk and return what was summed so far.

Source from the content-addressed store, hash-verified

48
49// Total size of every regular file under dir (recursive). Best-effort: I/O errors
50// stop the walk and return what was summed so far.
51int64_t DirSizeBytes(const std::filesystem::path& dir)
52{
53 std::error_code ec;
54 int64_t total = 0;
55 std::filesystem::recursive_directory_iterator it(dir, ec), end;
56 for (; it != end; it.increment(ec))
57 {
58 if (ec)
59 break;
60 std::error_code fec;
61 if (it->is_regular_file(fec))
62 total += static_cast<int64_t>(it->file_size(fec));
63 }
64 return total;
65}
66
67// Display name: the mod.json "name" when present, else the folder name with a

Callers 1

ScanModsRootFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected