Files
UnrealEngineUWP/Engine/Source/Developer/Android/AndroidPlatformEditor/Private/AndroidSDKSettingsCustomization.cpp
Robert Jones b5a273a278 SDK path editing in editor.
- Added class to hold values (AndroidSDKSettings)
- Added code to Android editor module to setup the values on load
- Changed device detection so that the thread is always started and the SDK path can be changed on the fly
- Changed Platform Target Management Module so that a single platform can be checked via UBT
- Settings can now be sourced from an ini file via temp direct reading code (auto seralisation is disabled until later changes are made)
-- Settings currently not exposed in editor

- Added Mac Environment var setting support

Unreleated
- Envars can now be passed down to process start points in tools

#codereview michael.trepka

[CL 2412194 by Robert Jones in Main branch]
2015-01-20 10:05:42 -05:00

106 lines
2.6 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "AndroidPlatformEditorPrivatePCH.h"
#include "AndroidSDKSettingsCustomization.h"
#include "DetailLayoutBuilder.h"
#include "DetailCategoryBuilder.h"
#include "PropertyEditing.h"
#include "ScopedTransaction.h"
#include "SExternalImageReference.h"
#include "SHyperlinkLaunchURL.h"
#include "SPlatformSetupMessage.h"
#include "SFilePathPicker.h"
#include "PlatformIconInfo.h"
#include "SourceControlHelpers.h"
#include "ManifestUpdateHelper.h"
#include "SNotificationList.h"
#include "NotificationManager.h"
#include "ITargetPlatformManagerModule.h"
#define LOCTEXT_NAMESPACE "AndroidSDKSettings"
//////////////////////////////////////////////////////////////////////////
// FAndroidSDKSettingsCustomization
TSharedRef<IDetailCustomization> FAndroidSDKSettingsCustomization::MakeInstance()
{
return MakeShareable(new FAndroidSDKSettingsCustomization);
}
FAndroidSDKSettingsCustomization::FAndroidSDKSettingsCustomization()
{
TargetPlatformManagerModule = &FModuleManager::LoadModuleChecked<ITargetPlatformManagerModule>("TargetPlatform");
SetupSDKPaths();
}
void FAndroidSDKSettingsCustomization::CustomizeDetails(IDetailLayoutBuilder& DetailLayout)
{
SavedLayoutBuilder = &DetailLayout;
BuildSDKPathSection(DetailLayout);
}
void FAndroidSDKSettingsCustomization::BuildSDKPathSection(IDetailLayoutBuilder& DetailLayout)
{
SetupSDKPaths();}
void FAndroidSDKSettingsCustomization::SetupSDKPaths()
{
// Try and query the env vars
UAndroidSDKSettings * settings = GetMutableDefault<UAndroidSDKSettings>();
bool changed = false;
if (settings->SDKPath.Path.IsEmpty())
{
TCHAR AndroidSDKPath[256];
FPlatformMisc::GetEnvironmentVariable(TEXT("ANDROID_HOME"), AndroidSDKPath, ARRAY_COUNT(AndroidSDKPath));
if (AndroidSDKPath[0])
{
settings->SDKPath.Path = AndroidSDKPath;
changed |= true;
}
}
if (settings->NDKPath.Path.IsEmpty())
{
TCHAR AndroidNDKPath[256];
FPlatformMisc::GetEnvironmentVariable(TEXT("NDKROOT"), AndroidNDKPath, ARRAY_COUNT(AndroidNDKPath));
if (AndroidNDKPath[0])
{
settings->NDKPath.Path = AndroidNDKPath;
changed |= true;
}
}
if (settings->ANTPath.Path.IsEmpty())
{
TCHAR AndroidANTPath[256];
FPlatformMisc::GetEnvironmentVariable(TEXT("ANT_HOME"), AndroidANTPath, ARRAY_COUNT(AndroidANTPath));
if (AndroidANTPath[0])
{
settings->ANTPath.Path = AndroidANTPath;
changed |= true;
}
}
if (changed)
{
settings->Modify();
settings->SaveConfig();
}
settings->UpdateTargetModulePaths(false);
}
//////////////////////////////////////////////////////////////////////////
#undef LOCTEXT_NAMESPACE