Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Fixes #739
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmontemagno committed Oct 11, 2019
1 parent a6de2cb commit af15d1b
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/Media.Plugin/iOS/MediaPickerDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System.Drawing;
using System.Collections.Generic;
using System.Threading;
using System.Diagnostics;

namespace Plugin.Media
{
Expand Down Expand Up @@ -563,8 +564,23 @@ private async Task<MediaFile> GetMovieMediaFile(NSDictionary info)
options?.Directory ?? ((IsCaptured) ? string.Empty : "temp"),
options?.Name ?? Path.GetFileName(url.Path));


File.Move(url.Path, path);
try
{
File.Move(url.Path, path);
}
catch (Exception ex)
{
Debug.WriteLine($"Unable to move file, trying to copy. {ex.Message}");
File.Copy(url.Path, path);
try
{
File.Delete(url.Path);
}
catch (Exception)
{
Debug.WriteLine($"Unable to delete file, will be left around :( {ex.Message}");
}
}

string aPath = null;
if (source != UIImagePickerControllerSourceType.Camera)
Expand Down

0 comments on commit af15d1b

Please sign in to comment.