fix more crashes on the file dialog

oh yes, the wonders of dealing with this useless broken file dialog.
honestly I didn't think it was broken to this point...

and no, I don't want to use the **other** file dialog as it requires
C++17 which is too ahead of time
This commit is contained in:
tildearrow 2022-01-19 15:03:33 -05:00
parent b091404d63
commit f32f079ef8

View file

@ -1524,10 +1524,10 @@ namespace IGFD
} }
#else // dirent #else // dirent
struct dirent** files = nullptr; struct dirent** files = nullptr;
size_t n = scandir(path.c_str(), &files, nullptr, inAlphaSort); int n = scandir(path.c_str(), &files, nullptr, inAlphaSort);
if (n) if (n>0)
{ {
size_t i; int i;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
@ -2342,13 +2342,13 @@ namespace IGFD
if (puFileManager.puInputPathActivated) if (puFileManager.puInputPathActivated)
{ {
auto gio = ImGui::GetIO(); auto gio = ImGui::GetIO();
if (ImGui::IsKeyReleased(gio.KeyMap[ImGuiKey_Enter])) if (ImGui::IsKeyReleased(ImGuiKey_Enter))
{ {
puFileManager.SetCurrentPath(std::string(puFileManager.puInputPathBuffer)); puFileManager.SetCurrentPath(std::string(puFileManager.puInputPathBuffer));
puFileManager.OpenCurrentPath(*this); puFileManager.OpenCurrentPath(*this);
puFileManager.puInputPathActivated = false; puFileManager.puInputPathActivated = false;
} }
if (ImGui::IsKeyReleased(gio.KeyMap[ImGuiKey_Escape])) if (ImGui::IsKeyReleased(ImGuiKey_Escape))
{ {
puFileManager.puInputPathActivated = false; puFileManager.puInputPathActivated = false;
} }