mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-24 18:32:19 -05:00
Fix Plando Window Crash on new installs (#4557)
* Add check for Randomizer folder existing, and creating it if not, to plando window. * Changed seed list population to just bail if the Randomizer folder doesn't exist. Added button disabling to prevent crashes loading or saving empty structures.
This commit is contained in:
parent
9bed5af33b
commit
5dd3b39a83
@ -361,11 +361,13 @@ void PlandomizerPopulateSeedList() {
|
||||
existingSeedList.clear();
|
||||
auto spoilerPath = Ship::Context::GetPathRelativeToAppDirectory("Randomizer");
|
||||
|
||||
if (std::filesystem::exists(spoilerPath)) {
|
||||
for (const auto& entry : std::filesystem::directory_iterator(spoilerPath)) {
|
||||
if (entry.is_regular_file() && entry.path().extension() == ".json") {
|
||||
existingSeedList.push_back(entry.path().stem().string());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PlandomizerItemImageCorrection(Rando::Item randoItem) {
|
||||
@ -875,15 +877,18 @@ void PlandomizerDrawOptions() {
|
||||
} else {
|
||||
ImGui::Text("No Spoiler Logs found.");
|
||||
}
|
||||
|
||||
ImGui::BeginDisabled(existingSeedList.empty());
|
||||
if (ImGui::Button("Load")) {
|
||||
logTemp = existingSeedList[selectedList].c_str();
|
||||
PlandomizerLoadSpoilerLog(logTemp.c_str());
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
ImGui::BeginDisabled(spoilerLogData.empty());
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Save")) {
|
||||
PlandomizerSaveSpoilerLog();
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::SeparatorText("Current Seed Hash");
|
||||
|
Loading…
Reference in New Issue
Block a user