Plan display file actions in app core

This commit is contained in:
2026-06-03 03:38:14 +02:00
parent 712c28068d
commit 4af55a7d3f
9 changed files with 116 additions and 4 deletions

View File

@@ -9,6 +9,11 @@ enum class PickedPathAction {
invoke_callback,
};
enum class DisplayFileAction {
ignore_empty_path,
open_external_file,
};
[[nodiscard]] constexpr PickedPathAction plan_picked_path(std::string_view path) noexcept
{
return path.empty()
@@ -16,4 +21,11 @@ enum class PickedPathAction {
: PickedPathAction::invoke_callback;
}
[[nodiscard]] constexpr DisplayFileAction plan_display_file(std::string_view path) noexcept
{
return path.empty()
? DisplayFileAction::ignore_empty_path
: DisplayFileAction::open_external_file;
}
}

View File

@@ -311,6 +311,9 @@ void App::pick_dir(std::function<void(std::string path)> callback)
void App::display_file(std::string path)
{
if (pp::app::plan_display_file(path) == pp::app::DisplayFileAction::ignore_empty_path)
return;
#ifdef __IOS__
dispatch_async(dispatch_get_main_queue(), ^{
[ios_view display_file:path];