+2007-08-06 Aaron Bockover <abockover@novell.com>
+
+ * Environment.cs (ReadXdgUserDir): Support the changes to the
+ xdg-user-dirs spec that allow $HOME to start the path; also allows
+ for quotes surrounding the path (Patch ported from Banshee,
+ BGO #461596)
+
2007-07-28 Miguel de Icaza <miguel@novell.com>
* MulticastDelegate.cs (Equals): do not cast to avoid exceptions,
while ((line = reader.ReadLine ()) != null) {
line = line.Trim ();
int delim_index = line.IndexOf ('=');
- if (delim_index > 8 && line.Substring (0, delim_index) == key) {
- return Path.Combine (home_dir, line.Substring (delim_index + 1));
- }
+ if(delim_index > 8 && line.Substring (0, delim_index) == key) {
+ string path = line.Substring (delim_index + 1).Trim ('"');
+ bool relative = false;
+
+ if (path.StartsWith ("$HOME/")) {
+ relative = true;
+ path = path.Substring (6);
+ } else if (!path.StartsWith ("/")) {
+ relative = true;
+ }
+
+ return relative ? Path.Combine (home_dir, path) : path;
+ }
}
}
} catch (FileNotFoundException) {