Files
UnrealEngineUWP/Engine/Source/Developer/Virtualization/Private/VirtualizationUtilities.h
paul chipchase 05d81ee7f3 EditorBulkData and the virtualization system now use FIoHash directly and FPayloadId is removed
#rb Per.Larsson, Devin.Doucette
#jira UE-133497
#rnx
#preflight 61f835491c5ac5523462810a

- A lot of files have been touched but most of this is changing FPayload::IsValid to !FIoHash::IsZero, the main changes are in EditorBulkData/EditorBulkDataTests
- The only difference between FPayloadId and FIoHash is that the former considered the hash of an invalid or empty buffer to be 'invalid' too where as FIoHash would return a valid hash
-- To keep behaviour the same, we only hash payloads in EditorBulkData using a utility method ::HashBuffer which will not hash empty or invalid payloads and return a default FIoHash instead.
-- Unit tests have been extended to prove that the behaviour has not changed.

#ROBOMERGE-AUTHOR: paul.chipchase
#ROBOMERGE-SOURCE: CL 18806362 in //UE5/Release-5.0/... via CL 18808527 via CL 18821790
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18822154 by paul chipchase in ue5-main branch]
2022-02-02 02:21:24 -05:00

51 lines
1.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Containers/StringFwd.h"
#include "Containers/UnrealString.h"
struct FIoHash;
namespace UE::Virtualization::Utils
{
/**
* Converts a FIoHash into a file path.
*
* This utility will take an FIoHash and return a file path that is
* 3 directories deep. The first six characters of the id will be used to
* create the directory names, with each directory using two characters.
* The remaining thirty four characters will be used as the file name.
* Lastly the extension '.payload' will be applied to complete the path/
* Example: FIoHash 0139d6d5d477e32dfd2abd3c5bc8ea8507e8eef8 becomes
* 01/39/d6/d5d477e32dfd2abd3c5bc8ea8507e8eef8.payload'
*
* @param Id The payload identifier used to create the file path.
* @param OutPath Will be reset and then assigned the resulting file path.
* The string builder must have a capacity of at least 52 characters
to avoid reallocation.
*/
void PayloadIdToPath(const FIoHash& Id, FStringBuilderBase& OutPath);
/**
* Converts a FIoHash into a file path.
*
* See above for further details
*
* @param Id The payload identifier used to create the file path.
* @return The resulting file path.
*/
FString PayloadIdToPath(const FIoHash& Id);
/**
* Fill in the given string builder with the human readable message of the current system
* code, followed by the code value itself.
* In the system value is currently 0, then we assume that it was cleared before this was
* able to be called and write that the error is unknown instead of assuming that the
* operation was a success.
*/
void GetFormattedSystemError(FStringBuilderBase& SystemErrorMessage);
} // namespace UE::Virtualization::Utils