[INTEGRATE] Change 2456485 by Peter.Sauerbrei@peter.sauerbrei_MacPro on 2015/02/23 13:34:43

fix for ANDROID_HOME not being set on Mac by default
	UE-10257, UE-10277
	#lockdown josh.adams

[CL 2460097 by Ben Marsh in Main branch]
This commit is contained in:
Ben Marsh
2015-02-25 08:05:13 -05:00
parent 4e6116fbba
commit 5ecb09d26f

View File

@@ -313,6 +313,38 @@ public:
FString ADBPath;
#if PLATFORM_MAC
if (AndroidDirectory[0] == 0)
{
// didn't find ANDROID_HOME, so parse the .bash_profile file on MAC
FArchive* FileReader = IFileManager::Get().CreateFileReader(*FString([@"~/.bash_profile" stringByExpandingTildeInPath]));
if (FileReader)
{
const int64 FileSize = FileReader->TotalSize();
ANSICHAR* AnsiContents = (ANSICHAR*)FMemory::Malloc(FileSize);
FileReader->Serialize(AnsiContents, FileSize);
FileReader->Close();
delete FileReader;
TArray<FString> Lines;
FString(ANSI_TO_TCHAR(AnsiContents)).ParseIntoArrayLines(&Lines);
FMemory::Free(AnsiContents);
for (int32 Index = 0; Index < Lines.Num(); Index++)
{
if (AndroidDirectory[0] == 0 && Lines[Index].StartsWith(TEXT("export ANDROID_HOME=")))
{
FString Directory;
Lines[Index].Split(TEXT("="), NULL, &Directory);
Directory = Directory.Replace(TEXT("\""), TEXT(""));
FCString::Strcpy(AndroidDirectory, *Directory);
setenv("ANDROID_HOME", TCHAR_TO_ANSI(AndroidDirectory), 1);
}
}
}
}
#endif
if (AndroidDirectory[0] != 0)
{
#if PLATFORM_WINDOWS