MoveFile fails on iOS

If you look inside the implementation of MoveFile for iOS (which I have included as is with a comment added), you will notice the problem when it creates the iOS file paths. The TO path is as expected created as a write path. The FROM path is (logically) created as a read path, but the reality is you are planning to rename the file so it really needs to also be a write path. It is also highly unlikely iOS is going to like it if you try to move a file from inside the bundle to the documents directory.

I was trying to move a file I had downloaded to a temporary directory to a permanent location after I had verified it was ok. Since both locations were actually write paths in the Documents directory the current implementation of MoveFile would simply fail.

Now it may be necessary to have it behave differently in the face of certain commandline arguments that already change the behavior of ConvertToIOSPath. That currently wasn’t an issue for me, so I hadn’t worried about it.

bool FIOSPlatformFile::MoveFile(const TCHAR* To, const TCHAR* From)
	// move to the write path
	FString ToIOSFilename = ConvertToIOSPath(NormalizeFilename(To), true);

    // The false here should be changed to true for most use cases I can imagine.
    // Special casing may be necessary if the -iterate or -filehostip commandline options are set 
    // though as that already changes the behavior of ConvertToIOSPath
	FString FromIOSFilename = ConvertToIOSPath(NormalizeFilename(From), false);
	return rename(TCHAR_TO_UTF8(*FromIOSFilename), TCHAR_TO_UTF8(*ToIOSFilename)) != -1;