From 4bef707c81fd5d0d31afbfdfb6ad04cd69475323 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Wed, 17 Jun 2026 10:22:02 +0200 Subject: [PATCH] Own Apple storage paths in Apple platform state --- PanoPainter-OSX/main.cpp | 2 +- PanoPainter/GameViewController.m | 2 +- docs/modernization/roadmap.md | 6 ++++++ docs/modernization/tasks.md | 5 +++++ src/platform_apple/apple_platform_services.h | 2 ++ src/platform_apple/apple_platform_state.cpp | 7 ++++++- 6 files changed, 21 insertions(+), 3 deletions(-) diff --git a/PanoPainter-OSX/main.cpp b/PanoPainter-OSX/main.cpp index 23ebcce3..ae52450d 100644 --- a/PanoPainter-OSX/main.cpp +++ b/PanoPainter-OSX/main.cpp @@ -614,7 +614,7 @@ NSString* keyCodeToString(NSUInteger keyCode, NSUInteger mods) LOG("error creating settings path: %s", [[err localizedDescription] cStringUsingEncoding:NSASCIIStringEncoding]); } - pp::platform::legacy::set_legacy_storage_paths({ + pp::platform::apple::set_legacy_apple_storage_paths({ data_path, data_path, recording_path, diff --git a/PanoPainter/GameViewController.m b/PanoPainter/GameViewController.m index 4c68a5c3..dd26b539 100644 --- a/PanoPainter/GameViewController.m +++ b/PanoPainter/GameViewController.m @@ -153,7 +153,7 @@ std::recursive_mutex lock_mutex; LOG("error creating settings path: %s", [[err localizedDescription] cStringUsingEncoding:NSASCIIStringEncoding]); } - pp::platform::legacy::set_legacy_storage_paths({ + pp::platform::apple::set_legacy_apple_storage_paths({ data_path, data_path, recording_path, diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index 935fa9ea..af13cad7 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -70,6 +70,12 @@ What is already real: - `pp_app_core` Latest slice: +- `src/platform_apple/apple_platform_state.cpp` no longer reads Apple storage + paths from `pp::platform::legacy::active_legacy_storage_paths()`; + Apple-owned retained state now carries that path bundle. +- `PanoPainter-OSX/main.cpp` and `PanoPainter/GameViewController.m` now seed + Apple-owned storage paths directly instead of writing them through the shared + legacy storage-path singleton. - `src/platform_legacy/legacy_platform_state.*` now exposes an ownable Web platform-services entrypoint plus an explicit binding hook instead of only a retained fallback object. diff --git a/docs/modernization/tasks.md b/docs/modernization/tasks.md index 1d002926..8a89912e 100644 --- a/docs/modernization/tasks.md +++ b/docs/modernization/tasks.md @@ -78,6 +78,11 @@ Completed, blocked, and superseded task history moved to the queue is now ordered by code movement instead. Current slice: +- `src/platform_apple/apple_platform_state.cpp` now reads Apple storage paths + from Apple-owned retained state rather than the shared legacy storage-path + singleton. +- `PanoPainter-OSX/main.cpp` and `PanoPainter/GameViewController.m` now seed + Apple-owned storage paths directly. - `src/platform_legacy/legacy_platform_state.*` now exposes `create_legacy_web_platform_services()` plus an explicit binding hook for the retained Web service surface. diff --git a/src/platform_apple/apple_platform_services.h b/src/platform_apple/apple_platform_services.h index af41c945..aac956b0 100644 --- a/src/platform_apple/apple_platform_services.h +++ b/src/platform_apple/apple_platform_services.h @@ -28,6 +28,7 @@ struct RetainedLegacyAppleState final { View* osx_view = nullptr; AppOSX* osx_app = nullptr; #endif + pp::platform::PlatformStoragePaths storage_paths; }; struct AppleDocumentPickerBridge { @@ -98,6 +99,7 @@ private: [[nodiscard]] AppleDocumentPlatformServices& active_legacy_apple_document_platform_services(); [[nodiscard]] pp::platform::PlatformStoragePaths prepare_legacy_apple_storage_paths(); +void set_legacy_apple_storage_paths(pp::platform::PlatformStoragePaths paths); void set_legacy_apple_state( #if defined(__OBJC__) && defined(__IOS__) GameViewController* ios_view, diff --git a/src/platform_apple/apple_platform_state.cpp b/src/platform_apple/apple_platform_state.cpp index d1e44917..a93dc962 100644 --- a/src/platform_apple/apple_platform_state.cpp +++ b/src/platform_apple/apple_platform_state.cpp @@ -221,7 +221,12 @@ struct RetainedLegacyAppleDocumentPlatformState final { #elif defined(__OSX__) [apple_state.osx_app init_dirs]; #endif - return pp::platform::legacy::active_legacy_storage_paths(); + return apple_state.storage_paths; +} + +void set_legacy_apple_storage_paths(pp::platform::PlatformStoragePaths paths) +{ + active_legacy_apple_state().storage_paths = std::move(paths); } void set_legacy_apple_state(