SHARE
TWEET

Untitled

a guest Dec 11th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. NSUrl tmpFolder = NSFileManager.DefaultManager.GetTemporaryDirectory();
  2.                                     var tmpFileUrl = tmpFolder.Append(originalFileName, false);
  3.                                     // create a temporary file with the original filename instead of id.jpg (e.g. 3242.jpg -> pump_module.jpg)
  4.                                     NSError copyError;
  5.                                     NSFileManager.DefaultManager.Copy(fileUrl, tmpFileUrl, out copyError);
  6.                                     // if there was no error copying or the file already existed before copy
  7.                                     if (copyError == null || NSFileManager.DefaultManager.FileExists(tmpFileUrl.Path))
  8.                                     {
  9.                                         // the file in the tmp folder has the correct filename
  10.                                         shareFile = tmpFileUrl;
  11.                                     }
  12.                                     else
  13.                                     {
  14.                                         // on error fall back to the former name
  15.                                         shareFile = fileUrl;
  16.  
  17.                                     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top