Add app document route core

This commit is contained in:
2026-06-02 22:10:50 +02:00
parent e15894e4ea
commit 0e03e5940a
10 changed files with 204 additions and 12 deletions

View File

@@ -5,6 +5,7 @@
#include "node_dialog_open.h"
#include "node_progress_bar.h"
#include "mp4enc.h"
#include "app_core/document_route.h"
#include "renderer_gl/opengl_capabilities.h"
#ifdef __APPLE__
@@ -187,15 +188,11 @@ void App::create()
void App::open_document(std::string path)
{
std::regex r(R"((.*)[\\/]([^\\/]+)\.(\w+)$)");
std::smatch m;
if (!std::regex_search(path, m, r))
const auto route = pp::app::classify_document_open_path(path);
if (!route)
return;
std::string base = m[1].str();
std::string name = m[2].str();
std::string ext = m[3].str();
if (str_iequals(ext, "abr"))
if (route.value().kind == pp::app::DocumentOpenKind::import_abr)
{
auto mb = message_box("Import ABR", "Would you like to import the brushes?", true);
mb->on_submit = [this, path] (Node* target) {
@@ -203,7 +200,7 @@ void App::open_document(std::string path)
target->destroy();
};
}
else if (str_iequals(ext, "ppbr"))
else if (route.value().kind == pp::app::DocumentOpenKind::import_ppbr)
{
auto mb = message_box("Import PPBR", "Would you like to import the brushes?", true);
mb->on_submit = [this, path] (Node* target) {
@@ -213,6 +210,8 @@ void App::open_document(std::string path)
}
else
{
const std::string base = route.value().directory;
const std::string name = route.value().name;
auto open_action = [this, path, base, name] {
doc_name = name;
doc_dir = base;