mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2026-04-03 19:56:01 +00:00
Cleanup & optimizations
This commit is contained in:
committed by
Anonymous275
parent
0580ad67fd
commit
f52308c439
@@ -10,17 +10,23 @@ TResourceManager::TResourceManager() {
|
||||
if (!fs::exists(Path))
|
||||
fs::create_directories(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()))) + ";";
|
||||
std::string File(entry.path().string());
|
||||
if (auto pos = File.find(".zip"); pos != std::string::npos) {
|
||||
if (File.length() - pos == 4) {
|
||||
std::replace(File.begin(), File.end(),'\\','/');
|
||||
mFileList += File + ';';
|
||||
if(auto i = File.find_last_of('/'); i != std::string::npos){
|
||||
++i;
|
||||
File = File.substr(i,pos-i);
|
||||
}
|
||||
mTrimmedList += File + ';';
|
||||
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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user