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 69e4014..d06cc19 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 @@ -49,27 +49,16 @@ void FPS_AI_ConvAgentModule::EnsureSSLCertificates() 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). + // Check if cert already exists in Content/Certificates/. 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. + // Try to auto-copy from the plugin's Resources directory to Content/Certificates/. + // In packaged builds, Content/Certificates/ must be staged via + // DirectoriesToAlwaysStageAsNonUFS in DefaultGame.ini. TSharedPtr Plugin = IPluginManager::Get().FindPlugin(TEXT("PS_AI_ConvAgent")); if (Plugin.IsValid()) { @@ -79,10 +68,10 @@ void FPS_AI_ConvAgentModule::EnsureSSLCertificates() if (FPlatformFileManager::Get().GetPlatformFile().FileExists(*PluginCertPath)) { FPlatformFileManager::Get().GetPlatformFile().CreateDirectoryTree( - *FPaths::GetPath(CopyDestPath)); - if (FPlatformFileManager::Get().GetPlatformFile().CopyFile(*CopyDestPath, *PluginCertPath)) + *FPaths::GetPath(ProjectCertPath)); + if (FPlatformFileManager::Get().GetPlatformFile().CopyFile(*ProjectCertPath, *PluginCertPath)) { - UE_LOG(LogPS_AI_ConvAgent, Log, TEXT("Copied SSL cacert.pem from plugin to: %s"), *CopyDestPath); + UE_LOG(LogPS_AI_ConvAgent, Log, TEXT("Copied SSL cacert.pem from plugin to: %s"), *ProjectCertPath); return; } }