mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 14:23:44 -07:00
Surround preset file processing with the fs::exists check rather than returning early.
This commit is contained in:
parent
4e8e6d2313
commit
2d022e617d
1 changed files with 11 additions and 12 deletions
|
@ -193,12 +193,10 @@ void ParsePreset(nlohmann::json& json, std::string name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadPresets() {
|
void LoadPresets() {
|
||||||
if (!fs::exists(presetFolder)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!presets.empty()) {
|
if (!presets.empty()) {
|
||||||
presets.clear();
|
presets.clear();
|
||||||
}
|
}
|
||||||
|
if (fs::exists(presetFolder)) {
|
||||||
for (auto const& preset : fs::directory_iterator(presetFolder)) {
|
for (auto const& preset : fs::directory_iterator(presetFolder)) {
|
||||||
std::ifstream ifs(preset.path());
|
std::ifstream ifs(preset.path());
|
||||||
|
|
||||||
|
@ -211,6 +209,7 @@ void LoadPresets() {
|
||||||
}
|
}
|
||||||
ifs.close();
|
ifs.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
auto initData = std::make_shared<Ship::ResourceInitData>();
|
auto initData = std::make_shared<Ship::ResourceInitData>();
|
||||||
initData->Format = RESOURCE_FORMAT_BINARY;
|
initData->Format = RESOURCE_FORMAT_BINARY;
|
||||||
initData->Type = static_cast<uint32_t>(Ship::ResourceType::Json);
|
initData->Type = static_cast<uint32_t>(Ship::ResourceType::Json);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue