mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-02 07:45:26 +00:00
27 lines
927 B
C++
27 lines
927 B
C++
#include "TResourceManager.h"
|
|
|
|
#include <algorithm>
|
|
#include <filesystem>
|
|
|
|
namespace fs = std::filesystem;
|
|
|
|
TResourceManager::TResourceManager() {
|
|
std::string Path = Application::Settings.Resource + "/Client";
|
|
if (!fs::exists(Path))
|
|
fs::create_directory(Path);
|
|
for (const auto& entry : fs::directory_iterator(Path)) {
|
|
auto pos = entry.path().string().find(".zip");
|
|
if (pos != std::string::npos) {
|
|
if (entry.path().string().length() - pos == 4) {
|
|
mFileList += entry.path().string() + ";";
|
|
mFileSizes += std::to_string(uint64_t(fs::file_size(entry.path()))) + ";";
|
|
mMaxModSize += uint64_t(fs::file_size(entry.path()));
|
|
mModsLoaded++;
|
|
}
|
|
}
|
|
}
|
|
std::replace(mFileList.begin(), mFileList.end(), '\\', '/');
|
|
if (mModsLoaded)
|
|
info("Loaded " + std::to_string(mModsLoaded) + " Mods");
|
|
}
|