美文网首页xamarin开发技术
Xamarin下获得各平台应用所在文件夹路径的方法

Xamarin下获得各平台应用所在文件夹路径的方法

作者: 临岁之寒 | 来源:发表于2017-09-30 12:38 被阅读60次

Android:

// <AppHome>/files
string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

iOS:

// <AppHome>/Documents
string docFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // to meet Apple’s iCloud terms, content that is not generated by the user
// should be placed in the /Library folder or a subdirectory inside it
string libFolder = System.IO.Path.Combine(docFolder,"..", "Library");

WindowPhone:

// <AppHome>\local
string path = Windows.Storage.ApplicationData.Current.LocalFolder.Path;

相关文章

网友评论

  • 云力太心:我的想法是内核都用一种语言比如C++写,各平台接口和UI都用各自的SDK来写。完全一套代码适应不同平台,那只能局部区別对待各平台差异了
    临岁之寒:@云力太心 是的
    云力太心:@临岁之寒 可它把UI也包办了?另外能跨win linux吗
    临岁之寒:@云力太心 xamarin就是这样一项技术

本文标题:Xamarin下获得各平台应用所在文件夹路径的方法

本文链接:https://www.haomeiwen.com/subject/lbvgextx.html