get rid of NFD dependency since im using SDL3 and its builtin functionality
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include <SettingsWindow.hpp>
|
||||
#include <nfd.hpp>
|
||||
#include <log.hpp>
|
||||
#include <Options.hpp>
|
||||
#include <imgui.h>
|
||||
@@ -20,18 +19,22 @@ bool SettingsWindow::render() {
|
||||
|
||||
if(ImGui::BeginTabItem("General")) {
|
||||
if(ImGui::Button("Pick...")) {
|
||||
NFD::Guard guard;
|
||||
NFD::UniquePath outPath;
|
||||
SDL_ShowOpenFolderDialog([](void *userdata, const char * const *filelist, int filter) {
|
||||
SettingsWindow* settings = (SettingsWindow*)userdata;
|
||||
|
||||
if (!filelist) {
|
||||
panic("An error occured: %s", SDL_GetError());
|
||||
return;
|
||||
} else if (!*filelist) {
|
||||
warn("The user did not select any file.");
|
||||
warn("Most likely, the dialog was canceled.");
|
||||
return;
|
||||
}
|
||||
|
||||
auto result = NFD::PickFolder(outPath);
|
||||
if(result == NFD_ERROR)
|
||||
panic("Error: {}", NFD::GetError());
|
||||
|
||||
if(result != NFD_CANCEL) {
|
||||
savesPath = outPath.get();
|
||||
Options::GetInstance().SetValue<std::string>("general", "savePath", savesPath);
|
||||
applyEnabled = true;
|
||||
}
|
||||
settings->savesPath = *filelist;
|
||||
Options::GetInstance().SetValue<std::string>("general", "savePath", settings->savesPath);
|
||||
settings->applyEnabled = true;
|
||||
}, this, window.getHandle(), nullptr, false);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginDisabled();
|
||||
|
||||
Reference in New Issue
Block a user