x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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;
 }
Product Version: UE 4.12
Tags:
more ▼

asked Jun 22 '16 at 09:19 PM in C++ Programming

avatar image

Kim Power
1 1 3 3

(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question