Class StorageProviderExtensions
Group of public extensions for IStorageProvider class.
public static class StorageProviderExtensions
- Inheritance
-
StorageProviderExtensions
- Inherited Members
Methods
TryGetFileFromPathAsync(IStorageProvider, string)
Attempts to read file from the file-system by its path.
public static Task<IStorageFile?> TryGetFileFromPathAsync(this IStorageProvider provider, string filePath)
Parameters
provider
IStorageProviderfilePath
stringThe path of the item to retrieve in Uri format.
Returns
- Task<IStorageFile>
File or null if it doesn't exist.
Remarks
Uri path is usually expected to be an absolute path with "file" scheme. But it can be an uri with "content" scheme on the Android. It also might ask user for the permission, and throw an exception if it was denied.
TryGetFolderFromPathAsync(IStorageProvider, string)
Attempts to read folder from the file-system by its path.
public static Task<IStorageFolder?> TryGetFolderFromPathAsync(this IStorageProvider provider, string folderPath)
Parameters
provider
IStorageProviderfolderPath
stringThe path of the folder to retrieve in Uri format.
Returns
- Task<IStorageFolder>
Folder or null if it doesn't exist.
Remarks
Uri path is usually expected to be an absolute path with "file" scheme. But it can be an uri with "content" scheme on the Android. It also might ask user for the permission, and throw an exception if it was denied.
TryGetLocalPath(IStorageItem)
Gets the local file system path of the item as a string.
public static string? TryGetLocalPath(this IStorageItem item)
Parameters
item
IStorageItemStorage folder or file.
Returns
- string
Full local path to the folder or file if possible, otherwise null.
Remarks
Android platform usually uses "content:" virtual file paths and Browser platform has isolated access without full paths, so on these platforms this method will return null.