config: always create a themes directory for user.
authorCedric BAIL <c.bail@partner.samsung.com>
Mon, 9 Jun 2014 22:16:08 +0000 (00:16 +0200)
committerCedric BAIL <c.bail@partner.samsung.com>
Mon, 9 Jun 2014 22:19:19 +0000 (00:19 +0200)
This make it more logical as it is part of Elementary config, so it
should be elementary duty to create that directory.

@fix

legacy/elementary/src/lib/elm_config.c

index e3c8db6..68edc08 100644 (file)
@@ -1434,6 +1434,16 @@ _config_user_load(void)
         cfg = eet_data_read(ef, _config_edd, "config");
         eet_close(ef);
      }
+
+   if (cfg)
+     {
+        size_t len;
+
+        len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "themes/");
+        if (len + 1 < sizeof(buf))
+          ecore_file_mkpath(buf);
+     }
+
    return cfg;
 }
 
@@ -1717,6 +1727,18 @@ _elm_config_save(void)
    Eet_File *ef;
    size_t len;
 
+   len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "themes/");
+   if (len + 1 >= sizeof(buf))
+     return EINA_FALSE;
+
+   ok = ecore_file_mkpath(buf);
+   if (!ok)
+     {
+        ERR("Problem accessing Elementary's user configuration directory: %s",
+            buf);
+        return EINA_FALSE;
+     }
+
    len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/%s",
                                        _elm_profile);
    if (len + 1 >= sizeof(buf))