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

@@ -71,6 +71,8 @@ std::recursive_mutex mutex;
int mutex_count = 0;
struct engine g_engine;
thread_local JNIEnv* jni;
std::shared_ptr<pp::platform::PlatformStoragePaths> g_android_storage_paths =
std::make_shared<pp::platform::PlatformStoragePaths>();
jint JNI_OnLoad(JavaVM* vm, void* /*reserved*/)
{
@@ -276,12 +278,12 @@ JNIEXPORT void JNICALL Java_com_omixlab_panopainter_MainActivity_pickExternalCal
App::I->data_path = file_path;
App::I->work_path = file_path;
App::I->rec_path = file_path + "/frames";
pp::platform::legacy::set_legacy_android_storage_paths({
*g_android_storage_paths = {
App::I->data_path,
App::I->work_path,
App::I->rec_path,
App::I->tmp_path,
});
};
App::I->initLog();
}
@@ -716,12 +718,12 @@ static int engine_init_display(struct engine* engine) {
if (App::I->data_path.empty() || App::I->data_path == ".")
App::I->data_path = get_data_path();
LOG("data_path %s", App::I->data_path.c_str());
pp::platform::legacy::set_legacy_android_storage_paths({
*g_android_storage_paths = {
App::I->data_path,
App::I->work_path.empty() ? App::I->data_path : App::I->work_path,
App::I->rec_path,
App::I->tmp_path,
});
};
#ifdef __QUEST__
@@ -1090,7 +1092,9 @@ void android_main(struct android_app* state) {
// Make sure glue isn't stripped.
// DON'T REMOVE, even if the compiler say it's deprecated
app_dummy();
auto platform_services = pp::platform::legacy::create_platform_services();
auto platform_services = pp::platform::legacy::create_platform_services({
.android_storage_paths = g_android_storage_paths,
});
App::I = new App;
App::I->set_platform_services(platform_services.get());