/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #pragma once #include "Math/ByteSize.hpp" #include namespace OpenVulkano { struct FsCount { size_t fileCount = 0, dirCount = 0; size_t GetTotalEntryCount() const { return fileCount + dirCount; } FsCount& operator +=(const FsCount& other) { fileCount += other.fileCount; dirCount += other.dirCount; return *this; } }; struct FsUtils { static bool DeleteEmptyFilesAndDirs(const std::filesystem::path& dir, bool recursive = true); static bool DeleteEmptyDirs(const std::filesystem::path& dir, bool recursive = true); static bool DeleteEmptySubTrees(const std::filesystem::path& dir); static bool IsTreeEmpty(const std::filesystem::path& dir); static ByteSize GetDirSize(const std::filesystem::path& dir); static FsCount GetDirFileAndDirCount(const std::filesystem::path& dir); static std::string ToValidFileName(std::string filename); }; }