You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Cleaned up some allocations caused by string manipulation. *Add a place for shared utility code that could have use in multiple places in the virtualization system. - First utility is a function to generate a file path based off a FPayloadId. - The path produced is similar to how we organize files in the DDC but instead of 0->9 we use the range 0->ff in hex. - To generate the path we take the string form of FPayloadId and then use the first 6 characters to create the directories (each directory using 2 characters) and then the remaining 34 characters becomes the filename. #rb Stefan.Boberg #rnx #ushell-cherrypick of 16167644 by paul.chipchase #preflight 608f9330f5b27a0001b2d5ab [CL 16182581 by paul chipchase in ue5-main branch]
35 lines
745 B
C++
35 lines
745 B
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);
|
|
}
|
|
|
|
} // namespace UE::Virtualization::Utils
|