2021-05-03 02:47:29 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "Containers/StringFwd.h"
|
|
|
|
|
#include "Containers/UnrealString.h"
|
|
|
|
|
|
2022-02-02 02:21:24 -05:00
|
|
|
struct FIoHash;
|
2021-05-03 02:47:29 -04:00
|
|
|
|
|
|
|
|
namespace UE::Virtualization::Utils
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
2022-02-02 02:21:24 -05:00
|
|
|
* Converts a FIoHash into a file path.
|
2021-05-03 02:47:29 -04:00
|
|
|
*
|
2022-02-02 02:21:24 -05:00
|
|
|
* This utility will take an FIoHash and return a file path that is
|
2021-05-03 02:47:29 -04:00
|
|
|
* 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/
|
2022-02-02 02:21:24 -05:00
|
|
|
* Example: FIoHash 0139d6d5d477e32dfd2abd3c5bc8ea8507e8eef8 becomes
|
2021-05-03 02:47:29 -04:00
|
|
|
* 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.
|
|
|
|
|
*/
|
2022-02-02 02:21:24 -05:00
|
|
|
void PayloadIdToPath(const FIoHash& Id, FStringBuilderBase& OutPath);
|
2021-05-03 02:47:29 -04:00
|
|
|
|
|
|
|
|
/**
|
2022-02-02 02:21:24 -05:00
|
|
|
* Converts a FIoHash into a file path.
|
2021-05-03 02:47:29 -04:00
|
|
|
*
|
|
|
|
|
* See above for further details
|
|
|
|
|
*
|
|
|
|
|
* @param Id The payload identifier used to create the file path.
|
|
|
|
|
* @return The resulting file path.
|
|
|
|
|
*/
|
2022-02-02 02:21:24 -05:00
|
|
|
FString PayloadIdToPath(const FIoHash& Id);
|
2021-05-03 02:47:29 -04:00
|
|
|
|
2021-10-12 21:21:22 -04:00
|
|
|
/**
|
|
|
|
|
* 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);
|
|
|
|
|
|
2021-05-03 02:47:29 -04:00
|
|
|
} // namespace UE::Virtualization::Utils
|