- Home /
System.IO.File get file created in iOS documents directory
I have an iOS native plugin that saves a file to the application documents directory. Upon successful completion of saving the file, I make a callback to unity with the filepath and check to see if the file exists.
I can confirm the file does exist in the iOS documents directory, as it is a video and I load the video natively and play it. However, in C# using System.IO.File, it does not seem to be able to find it.
void HandleRecordingSavedEvent (bool isSuccessful, string outputDir)
{
Debug.Log("Event callback for saved: " + isSuccessful + " at " + outputDir);
_recording = false;
_endTime = Time.time;
string[] pathComponents = outputDir.Split(new string[] { @"\/" }, System.StringSplitOptions.None);
string fileName = pathComponents[pathComponents.Length - 1];
string myGuess = Application.persistentDataPath + @"/" + fileName;
Debug.Log("My Guess " + myGuess);
if (File.Exists(myGuess))
Debug.Log("I found her!");
else
Debug.Log("Cannot find");
}
And in the console window when I run the application I get the following output
Event callback for saved: True at file:\/\/\/var\/mobile\/Containers\/Data\/Application\/80DBDE31-1BAA-4FB5-9D8B-C7A1E34B663A\/Documents\/2015-12-18%2012:47:11.mp4
My Guess /var/mobile/Containers/Data/Application/80DBDE31-1BAA-4FB5-9D8B-C7A1E34B663A/Documents/2015-12-18%2012:47:11.mp4
Cannot find
Can anyone spot something I am doing wrong?