[rygel] core: Don't assume user config dir to be present everywhere



commit 7bb93ffaf2bed39cc2a80ce77bab7fac0f670a17
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Oct 18 16:56:35 2010 +0300

    core: Don't assume user config dir to be present everywhere
    
    This assumption is only true for modern (free)desktops.

 src/rygel/rygel-root-device-factory.vala |    5 +++--
 src/rygel/rygel-user-config.vala         |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/rygel/rygel-root-device-factory.vala b/src/rygel/rygel-root-device-factory.vala
index 3eb1ad4..2f7541a 100644
--- a/src/rygel/rygel-root-device-factory.vala
+++ b/src/rygel/rygel-root-device-factory.vala
@@ -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);
     }
 
diff --git a/src/rygel/rygel-user-config.vala b/src/rygel/rygel-user-config.vala
index d90ee07..fe2b570 100644
--- a/src/rygel/rygel-user-config.vala
+++ b/src/rygel/rygel-user-config.vala
@@ -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");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]