Fuck git
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#include <GeneralSettings.hpp>
|
||||
#include <Options.hpp>
|
||||
#include <imgui.h>
|
||||
#include <log.hpp>
|
||||
|
||||
GeneralSettings::GeneralSettings(gui::NativeWindow& window) : window(window) {
|
||||
savesPath = Options::GetInstance().GetValue<std::string>("general", "savePath");
|
||||
}
|
||||
|
||||
void GeneralSettings::render() {
|
||||
if(ImGui::Button("Pick...")) {
|
||||
SDL_ShowOpenFolderDialog([](void *userdata, const char * const *filelist, int _) {
|
||||
auto* general = static_cast<GeneralSettings*>(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<std::string>("general", "savePath", general->savesPath);
|
||||
general->modified = true;
|
||||
}, this, window.getHandle(), nullptr, false);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginDisabled();
|
||||
ImGui::InputText("Save Path", const_cast<char*>(savesPath.c_str()), savesPath.length());
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
Reference in New Issue
Block a user