diff options
author | Ben Maurer <benm@mono-cvs.ximian.com> | 2004-06-25 23:08:20 +0400 |
---|---|---|
committer | Ben Maurer <benm@mono-cvs.ximian.com> | 2004-06-25 23:08:20 +0400 |
commit | e9c345319d65be140d959f9d139401be041316d2 (patch) | |
tree | 65c51f3452d42fa826e3c39d6db55b4d0024bb2a | |
parent | ec388a7eb38d9188c0724d2e52f0027114afe407 (diff) |
2004-06-25 Ben Maurer <bmaurer@ximian.com>
* Environment.cs: GetFolderPath has new behavior. r=miguel
svn path=/trunk/mcs/; revision=30410
-rw-r--r-- | mcs/class/corlib/System/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/class/corlib/System/Environment.cs | 61 |
2 files changed, 25 insertions, 40 deletions
diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog index ece576247cf..b345b93f069 100644 --- a/mcs/class/corlib/System/ChangeLog +++ b/mcs/class/corlib/System/ChangeLog @@ -1,3 +1,7 @@ +2004-06-25 Ben Maurer <bmaurer@ximian.com> + + * Environment.cs: GetFolderPath has new behavior. r=miguel + 2004-06-23 Sebastien Pouliot <sebastien@ximian.com> * DateTime.cs: Throw ArgumentOutOfRangeException if the year is diff --git a/mcs/class/corlib/System/Environment.cs b/mcs/class/corlib/System/Environment.cs index 9e9c0e93957..bf213ff4cb7 100644 --- a/mcs/class/corlib/System/Environment.cs +++ b/mcs/class/corlib/System/Environment.cs @@ -378,9 +378,6 @@ namespace System if ((int) Platform != 128) return GetWindowsFolderPath ((int) folder); - // we can do this in managed code for non-Windows environments - string path = String.Empty; - string home = internalGetHome (); // http://freedesktop.org/Standards/basedir-spec/basedir-spec-0.6.html @@ -395,68 +392,52 @@ namespace System config = Path.Combine (home, ".config"); } - string cache = GetEnvironmentVariable ("XDG_CACHE_HOME"); - if ((cache == null) || (cache == String.Empty)) { - cache = Path.Combine (home, ".cache"); - } - switch (folder) { #if NET_1_1 - case SpecialFolder.MyComputer: // MyComputer is a virtual directory - path = ""; - break; -#endif - + // MyComputer is a virtual directory + case SpecialFolder.MyComputer: + return ""; +#endif + // personal == ~ case SpecialFolder.Personal: - path = home; - break; - - // data related + return home; + // use FDO's CONFIG_HOME. This data will be synced across a network like the windows counterpart. case SpecialFolder.ApplicationData: + return config; + //use FDO's DATA_HOME. This is *NOT* synced case SpecialFolder.LocalApplicationData: - case SpecialFolder.MyMusic: - case SpecialFolder.MyPictures: - case SpecialFolder.Templates: - path = data; - break; - - // configuration related + return data; #if NET_1_1 case SpecialFolder.Desktop: #endif case SpecialFolder.DesktopDirectory: + return Path.Combine (home, "Desktop"); + + // these simply dont exist on Linux + // The spec says if a folder doesnt exist, we + // should return "" case SpecialFolder.Favorites: case SpecialFolder.Programs: case SpecialFolder.SendTo: case SpecialFolder.StartMenu: case SpecialFolder.Startup: - path = config; - break; - - // cache related (could disappear) + case SpecialFolder.MyMusic: + case SpecialFolder.MyPictures: + case SpecialFolder.Templates: case SpecialFolder.Cookies: case SpecialFolder.History: case SpecialFolder.InternetCache: case SpecialFolder.Recent: - path = cache; - break; - - // programs case SpecialFolder.CommonProgramFiles: case SpecialFolder.ProgramFiles: case SpecialFolder.System: - break; - - // Directories shared by all users + return ""; + // This is where data common to all users goes case SpecialFolder.CommonApplicationData: - path = Path.GetDirectoryName (GetMachineConfigPath ()); - break; - + return "/usr/share"; default: throw new ArgumentException ("Invalid SpecialFolder"); } - - return path; } public static string[] GetLogicalDrives () |