/// <summary> /// Gets the parent folder of the current file. /// </summary> /// <returns></returns> public Task <StorageFolder> GetParentAsync() { #if WINDOWS_UWP || WINDOWS_APP return(Task.Run <StorageFolder>(async() => { var parent = await _file.GetParentAsync(); return parent == null ? null : parent; })); #elif __ANDROID__ || __UNIFIED__ || WIN32 || TIZEN return(Task.Run <StorageFolder>(() => { var parent = global::System.IO.Directory.GetParent(Path); return parent == null ? null : new StorageFolder(parent.FullName); })); #elif WINDOWS_PHONE_APP || WINDOWS_PHONE return(Task.Run <StorageFolder>(async() => { var parentPath = global::System.IO.Path.GetPathRoot(Path.TrimEnd('\\')); Windows.Storage.StorageFolder parent = null; if (!string.IsNullOrEmpty(parentPath)) { parent = await Windows.Storage.StorageFolder.GetFolderFromPathAsync(parentPath); } return parent == null ? null : parent; })); #else throw new PlatformNotSupportedException(); #endif }
private async Task <FileAccessPolyFill.StorageFolder> GetParentAsyncHelper() { var content = await _file.GetParentAsync(); return(new FileAccessPolyFill.StorageFolder(content)); }