Own Android storage paths in legacy platform services

This commit is contained in:
2026-06-17 11:11:17 +02:00
parent cf2fcd36e4
commit 81a998436d
10 changed files with 49 additions and 56 deletions

View File

@@ -48,8 +48,11 @@ namespace {
// DEBT-0017: fallback for platforms that do not inject PlatformServices yet.
class LegacyPlatformServices final : public pp::platform::PlatformServices {
public:
explicit LegacyPlatformServices(pp::platform::legacy::LegacyGlfwPlatformShell glfw_shell = {})
: glfw_shell_(std::move(glfw_shell))
explicit LegacyPlatformServices(pp::platform::legacy::LegacyPlatformServicesConfig config = {})
: glfw_shell_(std::move(config.glfw_shell))
#ifdef __ANDROID__
, android_storage_paths_(std::move(config.android_storage_paths))
#endif
{
}
@@ -89,7 +92,7 @@ public:
{},
};
#elif defined(__ANDROID__)
return pp::platform::legacy::active_legacy_android_storage_paths();
return android_storage_paths_ ? *android_storage_paths_ : pp::platform::PlatformStoragePaths {};
#else
return {};
#endif
@@ -559,6 +562,9 @@ private:
}
pp::platform::legacy::LegacyGlfwPlatformShell glfw_shell_;
#ifdef __ANDROID__
std::shared_ptr<pp::platform::PlatformStoragePaths> android_storage_paths_;
#endif
};
}
@@ -572,8 +578,8 @@ PlatformServices& platform_services()
}
std::unique_ptr<PlatformServices> create_platform_services(
LegacyGlfwPlatformShell glfw_shell)
LegacyPlatformServicesConfig config)
{
return std::make_unique<LegacyPlatformServices>(std::move(glfw_shell));
return std::make_unique<LegacyPlatformServices>(std::move(config));
}
}