diff --git a/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/PS_AI_ConvAgent.uplugin b/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/PS_AI_ConvAgent.uplugin index 164b959..aa81aa4 100644 --- a/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/PS_AI_ConvAgent.uplugin +++ b/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/PS_AI_ConvAgent.uplugin @@ -22,7 +22,8 @@ "PlatformAllowList": [ "Win64", "Mac", - "Linux" + "Linux", + "Android" ] }, { diff --git a/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent.cpp b/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent.cpp index f89f0ea..69e4014 100644 --- a/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent.cpp +++ b/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent.cpp @@ -46,13 +46,29 @@ void FPS_AI_ConvAgentModule::StartupModule() void FPS_AI_ConvAgentModule::EnsureSSLCertificates() { - const FString ProjectCertPath = FPaths::ProjectContentDir() / TEXT("Certificates") / TEXT("cacert.pem"); + const FString CertRelPath = FString(TEXT("Certificates")) / TEXT("cacert.pem"); + const FString ProjectCertPath = FPaths::ProjectContentDir() / CertRelPath; + + // Check standard location (works on all platforms, including Android if cert was staged). if (FPlatformFileManager::Get().GetPlatformFile().FileExists(*ProjectCertPath)) { UE_LOG(LogPS_AI_ConvAgent, Log, TEXT("SSL cacert.pem found at: %s"), *ProjectCertPath); return; } +#if PLATFORM_ANDROID + // On Android, ProjectContentDir lives inside the APK (read-only). + // Use ProjectSavedDir as a writable fallback for the cert copy. + const FString CopyDestPath = FPaths::ProjectSavedDir() / CertRelPath; + if (FPlatformFileManager::Get().GetPlatformFile().FileExists(*CopyDestPath)) + { + UE_LOG(LogPS_AI_ConvAgent, Log, TEXT("SSL cacert.pem found at: %s"), *CopyDestPath); + return; + } +#else + const FString CopyDestPath = ProjectCertPath; +#endif + // Try to auto-copy from the plugin's Resources directory. TSharedPtr Plugin = IPluginManager::Get().FindPlugin(TEXT("PS_AI_ConvAgent")); if (Plugin.IsValid()) @@ -63,10 +79,10 @@ void FPS_AI_ConvAgentModule::EnsureSSLCertificates() if (FPlatformFileManager::Get().GetPlatformFile().FileExists(*PluginCertPath)) { FPlatformFileManager::Get().GetPlatformFile().CreateDirectoryTree( - *(FPaths::ProjectContentDir() / TEXT("Certificates"))); - if (FPlatformFileManager::Get().GetPlatformFile().CopyFile(*ProjectCertPath, *PluginCertPath)) + *FPaths::GetPath(CopyDestPath)); + if (FPlatformFileManager::Get().GetPlatformFile().CopyFile(*CopyDestPath, *PluginCertPath)) { - UE_LOG(LogPS_AI_ConvAgent, Log, TEXT("Copied SSL cacert.pem from plugin to: %s"), *ProjectCertPath); + UE_LOG(LogPS_AI_ConvAgent, Log, TEXT("Copied SSL cacert.pem from plugin to: %s"), *CopyDestPath); return; } }