mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-25 02:42:18 -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();
|
existingSeedList.clear();
|
||||||
auto spoilerPath = Ship::Context::GetPathRelativeToAppDirectory("Randomizer");
|
auto spoilerPath = Ship::Context::GetPathRelativeToAppDirectory("Randomizer");
|
||||||
|
|
||||||
|
if (std::filesystem::exists(spoilerPath)) {
|
||||||
for (const auto& entry : std::filesystem::directory_iterator(spoilerPath)) {
|
for (const auto& entry : std::filesystem::directory_iterator(spoilerPath)) {
|
||||||
if (entry.is_regular_file() && entry.path().extension() == ".json") {
|
if (entry.is_regular_file() && entry.path().extension() == ".json") {
|
||||||
existingSeedList.push_back(entry.path().stem().string());
|
existingSeedList.push_back(entry.path().stem().string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlandomizerItemImageCorrection(Rando::Item randoItem) {
|
void PlandomizerItemImageCorrection(Rando::Item randoItem) {
|
||||||
@ -875,15 +877,18 @@ void PlandomizerDrawOptions() {
|
|||||||
} else {
|
} else {
|
||||||
ImGui::Text("No Spoiler Logs found.");
|
ImGui::Text("No Spoiler Logs found.");
|
||||||
}
|
}
|
||||||
|
ImGui::BeginDisabled(existingSeedList.empty());
|
||||||
if (ImGui::Button("Load")) {
|
if (ImGui::Button("Load")) {
|
||||||
logTemp = existingSeedList[selectedList].c_str();
|
logTemp = existingSeedList[selectedList].c_str();
|
||||||
PlandomizerLoadSpoilerLog(logTemp.c_str());
|
PlandomizerLoadSpoilerLog(logTemp.c_str());
|
||||||
}
|
}
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
ImGui::BeginDisabled(spoilerLogData.empty());
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Save")) {
|
if (ImGui::Button("Save")) {
|
||||||
PlandomizerSaveSpoilerLog();
|
PlandomizerSaveSpoilerLog();
|
||||||
}
|
}
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::SeparatorText("Current Seed Hash");
|
ImGui::SeparatorText("Current Seed Hash");
|
||||||
|
Loading…
Reference in New Issue
Block a user