mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2025-01-12 18:39:32 +08:00
Update settings_parser.cpp
adding code from recommended PR
This commit is contained in:
parent
0f002f7ef9
commit
146c01a9c3
@ -805,7 +805,20 @@ static void parse_mods_folder(class Settings *settings_client, Settings *setting
|
|||||||
newMod.tagsTruncated = false;
|
newMod.tagsTruncated = false;
|
||||||
newMod.tags = mod.value().value("tags", std::string(""));
|
newMod.tags = mod.value().value("tags", std::string(""));
|
||||||
newMod.primaryFileName = mod.value().value("primary_filename", std::string(""));
|
newMod.primaryFileName = mod.value().value("primary_filename", std::string(""));
|
||||||
|
if(newMod.primaryFileName!=""){
|
||||||
|
long begin = 0, end = 0;
|
||||||
|
const char* name = primaryFileName;
|
||||||
|
std::fstream file(name);
|
||||||
|
begin = file.tellg();
|
||||||
|
file.seekg(0, std::ios::end);
|
||||||
|
end = file.tellg();
|
||||||
|
file.close();
|
||||||
|
newMod.primaryFileSize = mod.value().value("primary_filesize", (end-begin));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
newMod.primaryFileSize = mod.value().value("primary_filesize", (int32)1000000);
|
newMod.primaryFileSize = mod.value().value("primary_filesize", (int32)1000000);
|
||||||
|
}
|
||||||
newMod.previewFileName = mod.value().value("preview_filename", std::string(""));
|
newMod.previewFileName = mod.value().value("preview_filename", std::string(""));
|
||||||
newMod.previewFileSize = mod.value().value("preview_filesize", (int32)1000000);
|
newMod.previewFileSize = mod.value().value("preview_filesize", (int32)1000000);
|
||||||
newMod.workshopItemURL = mod.value().value("workshop_item_url", std::string(""));
|
newMod.workshopItemURL = mod.value().value("workshop_item_url", std::string(""));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user