diff --git a/lib/libimhex/source/ui/view.cpp b/lib/libimhex/source/ui/view.cpp index f6bc923a8..c9152e9fe 100644 --- a/lib/libimhex/source/ui/view.cpp +++ b/lib/libimhex/source/ui/view.cpp @@ -118,12 +118,18 @@ namespace hex { } void View::showFileChooserPopup(const std::vector &paths, const std::vector &validExtensions, const std::function &callback) { - View::s_selectableFileIndex = 0; - View::s_selectableFiles = paths; - View::s_selectableFilesValidExtensions = validExtensions; - View::s_selectableFileOpenCallback = callback; + if (paths.empty()) { + hex::openFileBrowser("hex.builtin.common.open"_lang, DialogMode::Open, validExtensions, [callback](const auto &path) { + callback(path); + }); + } else { + View::s_selectableFileIndex = 0; + View::s_selectableFiles = paths; + View::s_selectableFilesValidExtensions = validExtensions; + View::s_selectableFileOpenCallback = callback; - ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.builtin.common.choose_file"_lang); }); + ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.builtin.common.choose_file"_lang); }); + } } bool View::hasViewMenuItemEntry() const {