我正在尝试将以下内容移植到UWP应用程序:
var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string spotlightPath = System.IO.Path.Combine(localAppData, "Packages\\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\\LocalState\\Assets");
看起来ApplicationData.LocalFolder正是我所需要的:“获取本地应用程序数据存储中的根文件夹。”
(来自https://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.applicationdata.aspx)
我无法解决如何访问它:
var localAppData = ApplicationData.LocalFolder;
给出以下错误:非静态字段,方法或属性'ApplicationData.LocalFolder'
需要对象引用答案 0 :(得分:0)
使用它来访问您应用的本地文件夹:
var localFolder = ApplicationData.Current.LocalSettings;
答案 1 :(得分:0)
如果您希望获取应用程序设置和文件的路径:
Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
string ThePath = localFolder.Path;
https://docs.microsoft.com/en-us/previous-versions/windows/desktop/apps/hh700361(v=win.10)