You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
This represents UE4/Main @17774255, Release-5.0 @17791557 and Dev-PerfTest @17789485 [CL 17794212 by aurel cordonnier in ue5-release-engine-test branch]
55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "VirtualizationUtilities.h"
|
|
|
|
#include "Misc/StringBuilder.h"
|
|
#include "Virtualization/PayloadId.h"
|
|
|
|
namespace UE::Virtualization::Utils
|
|
{
|
|
|
|
void PayloadIdToPath(const FPayloadId& Id, FStringBuilderBase& OutPath)
|
|
{
|
|
OutPath.Reset();
|
|
OutPath << Id;
|
|
|
|
TStringBuilder<10> Directory;
|
|
Directory << OutPath.ToView().Left(2) << TEXT("/");
|
|
Directory << OutPath.ToView().Mid(2, 2) << TEXT("/");
|
|
Directory << OutPath.ToView().Mid(4, 2) << TEXT("/");
|
|
|
|
OutPath.ReplaceAt(0, 6, Directory);
|
|
|
|
OutPath << TEXT(".payload");
|
|
}
|
|
|
|
FString PayloadIdToPath(const FPayloadId& Id)
|
|
{
|
|
TStringBuilder<52> Path;
|
|
PayloadIdToPath(Id, Path);
|
|
|
|
return FString(Path);
|
|
}
|
|
|
|
void GetFormattedSystemError(FStringBuilderBase& SystemErrorMessage)
|
|
{
|
|
SystemErrorMessage.Reset();
|
|
|
|
const uint32 SystemError = FPlatformMisc::GetLastError();
|
|
// If we have a system error we can give a more informative error message but don't output it if the error is zero as
|
|
// this can lead to very confusing error messages.
|
|
if (SystemError != 0)
|
|
{
|
|
TCHAR SystemErrorMsg[MAX_SPRINTF] = { 0 };
|
|
FPlatformMisc::GetSystemErrorMessage(SystemErrorMsg, sizeof(SystemErrorMsg), SystemError);
|
|
|
|
SystemErrorMessage.Appendf(TEXT("'%s' (%d)"), SystemErrorMsg, SystemError);
|
|
}
|
|
else
|
|
{
|
|
SystemErrorMessage << TEXT("'unknown reason' (0)");
|
|
}
|
|
}
|
|
|
|
} // namespace UE::Virtualization::Utils
|