core: Don't assume user config dir to be present everywhere
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 18 Oct 2010 13:56:35 +0000 (16:56 +0300)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 18 Oct 2010 16:06:07 +0000 (19:06 +0300)
This assumption is only true for modern (free)desktops.

src/rygel/rygel-root-device-factory.vala
src/rygel/rygel-user-config.vala

index 3eb1ad4..2f7541a 100644 (file)
@@ -55,8 +55,9 @@ internal class Rygel.RootDeviceFactory {
         this.context = context;
 
         /* We store the modified descriptions in the user's config dir */
-        this.desc_dir = Path.build_filename (Environment.get_user_config_dir (),
-                                             "Rygel");
+        var config_dir = Environment.get_user_config_dir ();
+        this.ensure_dir_exists (config_dir);
+        this.desc_dir = Path.build_filename (config_dir, "Rygel");
         this.ensure_dir_exists (this.desc_dir);
     }
 
index d90ee07..fe2b570 100644 (file)
@@ -284,9 +284,10 @@ public class Rygel.UserConfig : GLib.Object, Configuration {
     }
 
     private void enable_upnp (bool enable) {
-        var dest_dir = Path.build_filename (Environment.get_user_config_dir (),
-                                             "autostart");
         try {
+            var config_dir = Environment.get_user_config_dir ();
+            this.ensure_dir_exists (config_dir);
+            var dest_dir = Path.build_filename (config_dir, "autostart");
             this.ensure_dir_exists (dest_dir);
 
             var dest_path = Path.build_filename (dest_dir, "rygel.desktop");