FullscreenUI: Use native file selector on Flatpak
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
#include "gpu_device.h"
|
||||
#include "image.h"
|
||||
#include "imgui_animated.h"
|
||||
#include "imgui_manager.h"
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/easing.h"
|
||||
@ -2072,7 +2073,7 @@ void ImGuiFullscreen::PopulateFileSelectorItems()
|
||||
if (s_file_selector_filters.empty() ||
|
||||
std::none_of(s_file_selector_filters.begin(), s_file_selector_filters.end(),
|
||||
[&fd](const std::string& filter) {
|
||||
return StringUtil::WildcardMatch(fd.FileName.c_str(), filter.c_str());
|
||||
return StringUtil::WildcardMatch(fd.FileName.c_str(), filter.c_str(), false);
|
||||
}))
|
||||
{
|
||||
continue;
|
||||
@ -2102,6 +2103,16 @@ bool ImGuiFullscreen::IsFileSelectorOpen()
|
||||
void ImGuiFullscreen::OpenFileSelector(std::string_view title, bool select_directory, FileSelectorCallback callback,
|
||||
FileSelectorFilters filters, std::string initial_directory)
|
||||
{
|
||||
if (initial_directory.empty() || !FileSystem::DirectoryExists(initial_directory.c_str()))
|
||||
initial_directory = FileSystem::GetWorkingDirectory();
|
||||
|
||||
if (Host::ShouldPreferHostFileSelector())
|
||||
{
|
||||
Host::OpenHostFileSelectorAsync(ImGuiManager::StripIconCharacters(title), select_directory, std::move(callback),
|
||||
std::move(filters), initial_directory);
|
||||
return;
|
||||
}
|
||||
|
||||
if (s_file_selector_open)
|
||||
CloseFileSelector();
|
||||
|
||||
@ -2111,8 +2122,6 @@ void ImGuiFullscreen::OpenFileSelector(std::string_view title, bool select_direc
|
||||
s_file_selector_callback = std::move(callback);
|
||||
s_file_selector_filters = std::move(filters);
|
||||
|
||||
if (initial_directory.empty() || !FileSystem::DirectoryExists(initial_directory.c_str()))
|
||||
initial_directory = FileSystem::GetWorkingDirectory();
|
||||
SetFileSelectorDirectory(std::move(initial_directory));
|
||||
QueueResetFocus();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user