Have you included:
- GenericPlatform/GenericPlatformFile.h
You might also want:
- HAL/PlatformFilemanager.h
- Misc/FileHelper.h
depending on what you’re doing.
Have you included:
You might also want:
depending on what you’re doing.
Does anyone know why am I getting these errors when adding PlatformFile and IFileHandle into my code. (PlatformFile) gives me “Incomplete type is not allowed” and (IFileHandle) gives me “Pointer to incomplete type is not allowed”. I get these error on these lines.
FileHandle->Write(Response->GetContent().GetData(), Response->GetContentLength());
if (!PlatformFile.DirectoryExists(*Path))
void UDownloader::OnReady(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{
RemoveFromRoot();
Request->OnProcessRequestComplete().Unbind();
FString FileSavePath = "E:\\AssetFolder\\" + AssetID;
if (Response.IsValid() && EHttpResponseCodes::IsOk(Response->GetResponseCode()))
{
// SAVE FILE
IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
// create save directory if not existent
FString Path, Filename, Extension;
FPaths::Split(FileSavePath, Path, Filename, Extension);
if (!PlatformFile.DirectoryExists(*Path))
{
if (!PlatformFile.CreateDirectoryTree(*Path))
{
return;
}
}
// open/create the file
IFileHandle* FileHandle = PlatformFile.OpenWrite(*FileSavePath);
if (FileHandle)
{
// write the file
FileHandle->Write(Response->GetContent().GetData(), Response->GetContentLength());
// Close the file
delete FileHandle;
}
else
{
}
}
}
Thank you! I actually got it to work after finding the answer on UE4 API http://api.unrealengine.com/INT/API/Runtime/Core/GenericPlatform/IFileHandle/index.html