Getting all files in UWP app folder

前端 未结 2 1866
迷失自我
迷失自我 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 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();
    

提交回复
热议问题