Getting all files in UWP app folder

前端 未结 2 1867
迷失自我
迷失自我 2020-12-14 17:37

For UWP, it is easy to get all files in the app local folder as:

IReadOnlyList files = await ApplicationData.Current.LocalFolder.GetFilesAsy

相关标签:
2条回答
  • 2020-12-14 17:53
    var storageFolder = await ApplicationData.Current.LocalFolder.GetFolderAsync("Assets");
    var files = await storageFolder.GetFilesAsync();
    

    https://docs.microsoft.com/en-us/uwp/api/windows.storage.applicationdata

    0 讨论(0)
  • 2020-12-14 18:08

    You can access you installation folder by using Package.InstalledLocation. Therefore your code can look like this:

    StorageFolder appInstalledFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
    StorageFolder assets = await appInstalledFolder.GetFolderAsync("Assets");
    var files = await assets.GetFilesAsync();
    
    0 讨论(0)
提交回复
热议问题