Add Android platform support to plugin
Whitelist Android in .uplugin Runtime module and handle read-only APK paths for SSL certificate copy on Android (ProjectSavedDir fallback). No change to Win64 behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8fcb8b6f30
commit
5fcd98ba73
@ -22,7 +22,8 @@
|
||||
"PlatformAllowList": [
|
||||
"Win64",
|
||||
"Mac",
|
||||
"Linux"
|
||||
"Linux",
|
||||
"Android"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@ -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<IPlugin> 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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user