This setup should copy the file from one folder to another, but it does not work for me
Im checking if the Source File is exist which it does, and checked the Target Directory also exist
Testing in editor in UE5.5
I imagine that my input strings might be incorrect?
If that is the case, how should I modify then, how would it be correct?
I would really appreciate if someone could point me in the right direction, what am I missing
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "FileLibrary.generated.h"
/**
*
*/
UCLASS()
class COPYSAVE_API UFileLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category="File Operations")
static bool CopyFile(FString SourceFile, FString TargetFile);
};
.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "FileLibrary.h"
bool UFileLibrary::CopyFile(FString SourceFile, FString TargetFile)
{
IPlatformFile& platformFile = FPlatformFileManager::Get().GetPlatformFile();
if (FPaths::FileExists(SourceFile))
{
UE_LOG(LogTemp, Error, TEXT("Source file %s does not exist"), *SourceFile);
return platformFile.CopyFile(*TargetFile, *SourceFile);
}
else return false;
}