From 64f534328924013a93bda360bc0682315546b023 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 15 Jun 2022 02:03:20 -0500 Subject: [PATCH] I give up trying to fix this file dialog for now --- extern/igfd/ImGuiFileDialog.cpp | 10 ++++++---- src/gui/gui.cpp | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/extern/igfd/ImGuiFileDialog.cpp b/extern/igfd/ImGuiFileDialog.cpp index f7a2be5b..776ad373 100644 --- a/extern/igfd/ImGuiFileDialog.cpp +++ b/extern/igfd/ImGuiFileDialog.cpp @@ -1287,8 +1287,6 @@ namespace IGFD std::sort(prFileList.begin(), prFileList.end(), [](const std::shared_ptr& a, const std::shared_ptr& b) -> bool { - if (a==NULL || b==NULL) - return false; if (!a.use_count() || !b.use_count()) return false; @@ -1760,7 +1758,7 @@ namespace IGFD struct stat statInfos = {}; char timebuf[100]; int result = stat(fpn.c_str(), &statInfos); - if (!result) + if (result!=-1) { if (vInfos->fileType != 'd') { @@ -1781,7 +1779,11 @@ namespace IGFD { vInfos->fileModifDate = std::string(timebuf, len); } - } + } else { + vInfos->fileSize=0; + vInfos->formatedFileSize = prFormatFileSize(vInfos->fileSize); + vInfos->fileModifDate="???"; + } } } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index b982987c..fd904649 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -4105,6 +4105,7 @@ bool FurnaceGUI::init() { #ifndef __APPLE__ if (settings.dpiScale<0.5f) { + // TODO: replace with a function to actually detect the display scaling factor as it's unreliable. SDL_GetDisplayDPI(SDL_GetWindowDisplayIndex(sdlWin),&dpiScaleF,NULL,NULL); dpiScale=round(dpiScaleF/96.0f); if (dpiScale<1) dpiScale=1;