Skip to content

Commit

Permalink
Merge pull request MvvmCross#55 from ggirard07/windowsUWPFilePluginFi…
Browse files Browse the repository at this point in the history
…xCreateFolderAsync

Fixed folder path ended by a separator not properly handled on WindowsUWP
  • Loading branch information
martijn00 committed Feb 1, 2016
2 parents 93a82fc + 0e80cef commit ec8310d
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,14 @@ private static async Task<StorageFolder> CreateFolderAsync(StorageFolder rootFol
if (string.IsNullOrEmpty(folderPath))
return rootFolder;
var currentFolder = await CreateFolderAsync(rootFolder, Path.GetDirectoryName(folderPath)).ConfigureAwait(false);
return await currentFolder.CreateFolderAsync(Path.GetFileName(folderPath), CreationCollisionOption.OpenIfExists).AsTask().ConfigureAwait(false);

//folder name may be empty if original path was ended by a separator like My/Custom/Path/ instead of My/Custom/Path
var folderName = Path.GetFileName(folderPath);
if (string.IsNullOrEmpty(folderName))
return currentFolder;
else
return await currentFolder.CreateFolderAsync(Path.GetFileName(folderPath), CreationCollisionOption.OpenIfExists).AsTask().ConfigureAwait(false);

}

public override IEnumerable<string> GetFilesIn(string folderPath)
Expand Down

0 comments on commit ec8310d

Please sign in to comment.