#include #include #include #include GeneralSettings::GeneralSettings(gui::NativeWindow& window) : window(window) { savesPath = Options::GetInstance().GetValue("general", "savePath"); } void GeneralSettings::render() { if(ImGui::Button("Pick...")) { SDL_ShowOpenFolderDialog([](void *userdata, const char * const *filelist, int _) { auto* general = static_cast(userdata); if (!filelist) { panic("An error occurred: {}", SDL_GetError()); } if (!*filelist) { warn("The user did not select any file."); warn("Most likely, the dialog was canceled."); general->modified = false; return; } general->savesPath = fs::absolute(*filelist).string(); Options::GetInstance().SetValue("general", "savePath", general->savesPath); general->modified = true; }, this, window.getHandle(), nullptr, false); } ImGui::SameLine(); ImGui::BeginDisabled(); ImGui::InputText("Save Path", const_cast(savesPath.c_str()), savesPath.length()); ImGui::EndDisabled(); }