Monodroid 环境变量 [英] Monodroid Environment variables

查看:39
本文介绍了Monodroid 环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Android 中,Android.OS.Environment 中有一组可用的环境路径.但是,在考虑跨平台功能时,我想将图片存储在图片文件夹中,因此我想改用 System.Environment.GetFolderPath.但是,我的问题是这些都指向 Android 环境中的何处.我可以从以下获取有用的图片文件夹吗?

In Android there are a collection of Environment paths available at Android.OS.Environment. However, when keeping cross platform capabilities in mind, I want to store pictures in a pictures folder and so thought to use System.Environment.GetFolderPath instead. However, my question is where these all point to in an Android environment. Can I get a useful pictures folder from the following?

string path = Environment.GetFolderPath (Environment.SpecialFolder.MyPictures);

推荐答案

在逐步完成一些代码之后,我总结了 Xamarin Android 为下面每个不同的 System.Environment 变量提供的位置.我没有可用的 iOS 项目,但如果有人可以发布 iOS 等效项目,我将不胜感激.

After stepping through some code, I've summarised the locations given by Xamarin Android for each of the different System.Environment variables below. I don't have an iOS project available, but if anyone could post the iOS equivalents I'd be grateful.

ApplicationData         "/data/data/ProjectName.ProjectName/files/.config"
CommonApplicationData   "/usr/share"
CommonProgramFiles      ""
Cookies                 ""
Desktop                 "/data/data/ProjectName.ProjectName/files/Desktop"
DesktopDirectory        "/data/data/ProjectName.ProjectName/files/Desktop"
Favorites               ""
History                 ""
InternetCache           ""
LocalApplicationData    "/data/data/ProjectName.ProjectName/files/.local/share"
MyComputer              ""
MyDocuments             "/data/data/ProjectName.ProjectName/files"
MyMusic                 "/data/data/ProjectName.ProjectName/files/Music"
MyPictures              "/data/data/ProjectName.ProjectName/files/Pictures"
MyVideos                "/data/data/ProjectName.ProjectName/files/Videos"
Personal                "/data/data/ProjectName.ProjectName/files"
ProgramFiles            ""
Programs                ""
Recent                  ""
SendTo                  ""
StartMenu               ""
Startup                 ""
System                  ""
Templates               "/data/data/ProjectName.ProjectName/files/Templates"

这篇关于Monodroid 环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆