Skip to main content

TryGetFolderFromPathAsync Method

Attempts to read folder from the file-system by its path.

Definition​

Namespace: Avalonia.Platform.Storage
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public static Task<IStorageFolder?> TryGetFolderFromPathAsync(
this IStorageProvider provider,
string folderPath
)

Parameters​

  IStorageProvider
 
  String
The path of the folder to retrieve in Uri format.

Return Value​

Task(IStorageFolder)
Folder or null if it doesn't exist.

Usage Note​

In Visual Basic and C#, you can call this method as an instance method on any object of type IStorageProvider. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

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.

See Also​

Reference​

StorageProviderExtensions Class
Avalonia.Platform.Storage Namespace