Files
UnrealEngineUWP/Engine/Source/Developer/Android/AndroidPlatformEditor/Private/AndroidSDKSettings.cpp
Ben Marsh 13d012685f Merging copyright update from 4.19 branch.
#rb none
#rnx
#jira

[CL 3818977 by Ben Marsh in Staging-4.19 branch]
2018-01-02 15:30:26 -05:00

78 lines
1.7 KiB
C++

// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
#include "AndroidSDKSettings.h"
#include "Misc/Paths.h"
#include "Interfaces/IAndroidDeviceDetection.h"
//#include "EngineTypes.h"
#include "Interfaces/ITargetPlatformManagerModule.h"
DEFINE_LOG_CATEGORY_STATIC(AndroidSDKSettings, Log, All);
UAndroidSDKSettings::UAndroidSDKSettings(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
#if WITH_EDITOR
void UAndroidSDKSettings::PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent)
{
Super::PostEditChangeProperty(PropertyChangedEvent);
UpdateTargetModulePaths();
}
void UAndroidSDKSettings::SetTargetModule(ITargetPlatformManagerModule * InTargetManagerModule)
{
TargetManagerModule = InTargetManagerModule;
}
void UAndroidSDKSettings::SetDeviceDetection(IAndroidDeviceDetection * InAndroidDeviceDetection)
{
AndroidDeviceDetection = InAndroidDeviceDetection;
}
void UAndroidSDKSettings::UpdateTargetModulePaths()
{
TArray<FString> Keys;
TArray<FString> Values;
if (!SDKPath.Path.IsEmpty())
{
FPaths::NormalizeFilename(SDKPath.Path);
Keys.Add(TEXT("ANDROID_HOME"));
Values.Add(SDKPath.Path);
}
if (!NDKPath.Path.IsEmpty())
{
FPaths::NormalizeFilename(NDKPath.Path);
Keys.Add(TEXT("NDKROOT"));
Values.Add(NDKPath.Path);
}
if (!ANTPath.Path.IsEmpty())
{
FPaths::NormalizeFilename(ANTPath.Path);
Keys.Add(TEXT("ANT_HOME"));
Values.Add(ANTPath.Path);
}
if (!JavaPath.Path.IsEmpty())
{
FPaths::NormalizeFilename(JavaPath.Path);
Keys.Add(TEXT("JAVA_HOME"));
Values.Add(JavaPath.Path);
}
SaveConfig();
if (Keys.Num() != 0)
{
TargetManagerModule->UpdatePlatformEnvironment(TEXT("Android"), Keys, Values);
AndroidDeviceDetection->UpdateADBPath();
}
}
#endif