Extract PPBR package path validation

This commit is contained in:
2026-06-04 14:56:29 +02:00
parent 6ab64ccc82
commit 394979e4fc
11 changed files with 444 additions and 32 deletions

View File

@@ -20,6 +20,7 @@
#include "app_core/document_sharing.h"
#include "app_core/document_session.h"
#include "app_core/file_menu.h"
#include "assets/brush_package.h"
#include "app_core/grid_ui.h"
#include "app_core/history_ui.h"
#include "app_core/main_toolbar.h"
@@ -3671,6 +3672,18 @@ int plan_brush_package_export(int argc, char** argv)
return 2;
}
const auto paths = pp::assets::plan_ppbr_export_paths(
args.path,
args.destination_path,
args.export_data,
args.destination_path.empty()
? pp::assets::PpbrDataDirectoryPolicy::next_to_package
: pp::assets::PpbrDataDirectoryPolicy::override_directory);
if (!paths) {
print_error("plan-brush-package-export", paths.status().message);
return 2;
}
std::cout << "{\"ok\":true,\"command\":\"plan-brush-package-export\""
<< ",\"request\":{\"path\":\"" << json_escape(services.last_path)
<< "\",\"author\":\"" << json_escape(services.last_request.author)
@@ -3680,6 +3693,12 @@ int plan_brush_package_export(int argc, char** argv)
<< "\",\"destPath\":\"" << json_escape(services.last_request.destination_path)
<< "\",\"exportData\":" << json_bool(services.last_request.export_data)
<< ",\"hasHeaderImage\":" << json_bool(services.last_request.has_header_image)
<< "},\"paths\":{\"package\":\"" << json_escape(paths.value().package_path)
<< "\",\"directory\":\"" << json_escape(paths.value().directory)
<< "\",\"stem\":\"" << json_escape(paths.value().stem)
<< "\",\"extension\":\"" << json_escape(paths.value().extension)
<< "\",\"dataDirectory\":\"" << json_escape(paths.value().data_directory)
<< "\",\"dataDirectoryEnabled\":" << json_bool(paths.value().data_directory_enabled)
<< "},\"dispatches\":" << services.exports
<< "}\n";
return 0;