我正在使用Visual Studio 2017社区版为Raspberry Pi 3开发Windows Core应用程序。
我对该平台很陌生,并试图将一些内容文件复制到Raspberry。 我已尝试在属性窗口中将文件类型更改为“内容”和“始终复制”。
但是,我无法找到这些文件的复制位置,以及如何在我的代码中引用这些文件。
非常感谢任何帮助。
答案 0 :(得分:0)
但是,我无法找到这些文件的复制位置以及方式 我可以在我的代码中引用这些文件。
你可以得到这样的路径:
Windows.Storage.StorageFolder installedLocation = Windows.ApplicationModel.Package.Current.InstalledLocation;
并像这样访问这些文件:
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///copyfile test.txt"));
string text = await Windows.Storage.FileIO.ReadTextAsync(file);
有关详情,请参阅“File access permissions”和“Create, write, and read a file”。