jaehwan pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=b1c5de0b9aa67b9d5cc4722e9462830beb3af37b

commit b1c5de0b9aa67b9d5cc4722e9462830beb3af37b
Author: Jaehwan Kim <[email protected]>
Date:   Wed Jun 17 17:37:01 2015 +0900

    config: make a config directory, if it is not.
    
    create the config directory to register flush file to eio_monitor.
---
 src/lib/elm_config.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
index bf2ea32..fe6ad27 100644
--- a/src/lib/elm_config.c
+++ b/src/lib/elm_config.c
@@ -3338,9 +3338,22 @@ _elm_config_sub_init(void)
      }
 #endif
    char buf[PATH_MAX];
+   size_t len;
+   int ok = 0;
 
-   _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/%s/flush",
-                          _elm_profile);
+   len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/");
+   if (len + 6 >= sizeof(buf)) // the space to add "/flush"
+     goto end;
+
+   ok = ecore_file_mkpath(buf);
+   if (!ok)
+     {
+        ERR("Problem accessing Elementary's user configuration directory: %s",
+            buf);
+        goto end;
+     }
+
+   strcat(buf, "flush");
    if (!ecore_file_exists(buf))
      {
         FILE *f = fopen(buf, "w+");
@@ -3349,11 +3362,13 @@ _elm_config_sub_init(void)
           {
              fprintf(f, "flush");
              fclose(f);
+             goto end;
           }
      }
    _eio_monitor = eio_monitor_add(buf);
    ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, 
_elm_config_file_monitor_cb, NULL);
 
+end:
    _config_sub_apply();
 }
 

-- 


Reply via email to