Read file from subfolder of application installation folder

前端 未结 4 725
逝去的感伤
逝去的感伤 2021-01-15 11:13

I have to read the text content from an .txt file, this file is located in app installed folder, in a subfolder, according to Microsoft docs, I am doing it like

4条回答
  •  被撕碎了的回忆
    2021-01-15 12:05

    GetFileAsync will take relative path in form folder/fileName. You can also get folder first and than file or use GetItemAsync

    StorageFolder appFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
    // Get a file from a subfolder of the current folder
    // by providing a relative path.
    string image = @"Assets\Logo.scale-100.png";
    var logoImage = await appFolder.GetFileAsync(image);
    

提交回复
热议问题