Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSUrl tmpFolder = NSFileManager.DefaultManager.GetTemporaryDirectory();
- var tmpFileUrl = tmpFolder.Append(originalFileName, false);
- // create a temporary file with the original filename instead of id.jpg (e.g. 3242.jpg -> pump_module.jpg)
- NSError copyError;
- NSFileManager.DefaultManager.Copy(fileUrl, tmpFileUrl, out copyError);
- // if there was no error copying or the file already existed before copy
- if (copyError == null || NSFileManager.DefaultManager.FileExists(tmpFileUrl.Path))
- {
- // the file in the tmp folder has the correct filename
- shareFile = tmpFileUrl;
- }
- else
- {
- // on error fall back to the former name
- shareFile = fileUrl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement