This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch v-0.25.0
in repository enlightenment.

View the commit online.

commit 08b567f5cef689a7ec8661b4faa12eeb06008211
Author: Carsten Haitzler <ras...@rasterman.com>
AuthorDate: Mon May 16 13:59:29 2022 +0100

    e config - fix config fallback handling - it was broken
    
    loaded the wrong filename pattern due to a change i made ages to it
    from file.N.cfg to file.cfg.N.
    
    @fix
---
 src/bin/e_config.c | 37 ++++++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)

diff --git a/src/bin/e_config.c b/src/bin/e_config.c
index 746a677a7..22c63ef4e 100644
--- a/src/bin/e_config.c
+++ b/src/bin/e_config.c
@@ -122,6 +122,24 @@ _e_config_profile_name_get(Eet_File *ef)
           s = eina_stringshare_add_length(data, data_len);
         free(data);
      }
+   if (s)
+     {
+        char buf[PATH_MAX];
+        char buf2[PATH_MAX];
+
+        e_user_dir_snprintf(buf, sizeof(buf), "config/%s", s);
+        if (!ecore_file_is_dir(buf))
+          {
+             snprintf(buf2, sizeof(buf2), "config/%s", s);
+             e_prefix_data_concat_static(buf, buf2);
+             if (!ecore_file_is_dir(buf))
+               {
+                  printf("CF: warning - profile [%s] dir does not exist in user or system dirs\n", s);
+                  eina_stringshare_del(s);
+                  s = NULL;
+               }
+          }
+     }
    return s;
 }
 
@@ -172,7 +190,7 @@ _e_config_pending_file_del(const char *path)
 
         eina_hash_del(_e_config_pending_files, path, ef);
         eina_lock_release(&_e_config_pending_files_lock);
-        err = eet_close(ef);
+        eet_close(ef);
         switch (err)
           {
            case EET_ERROR_NONE:
@@ -1045,19 +1063,24 @@ e_config_init(void)
 
              for (i = 1; i <= _e_config_revisions; i++)
                {
-                  e_user_dir_snprintf(buf, sizeof(buf), "config/profile.%i.cfg", i);
+                  e_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg.%i", i);
                   ef = eet_open(buf, EET_FILE_MODE_READ);
                   if (ef)
                     {
+                       printf("CF: warning - falling back to %s\n", buf);
                        _e_config_profile = _e_config_profile_name_get(ef);
                        eet_close(ef);
                        ef = NULL;
                        if (_e_config_profile) break;
+                       printf("CF: warning - fallback to %s can't read profile\n", buf);
                     }
+                  else if (ecore_file_exists(buf))
+                    printf("CF: warning - fallback to %s failing to open\n", buf);
                }
              if (!_e_config_profile)
                {
                   /* use system if no user profile config */
+                  printf("CF: fallback to system profile config file\n");
                   e_prefix_data_concat_static(buf, "data/config/profile.cfg");
                   ef = eet_open(buf, EET_FILE_MODE_READ);
                }
@@ -1067,6 +1090,8 @@ e_config_init(void)
              _e_config_profile = _e_config_profile_name_get(ef);
              eet_close(ef);
              ef = NULL;
+             if (!_e_config_profile)
+               printf("CF: warning - can't read profile\n");
           }
         if (!_e_config_profile)
           {
@@ -2175,16 +2200,21 @@ e_config_domain_load(const char *domain, E_Config_DD *edd)
 
    for (i = 1; i <= _e_config_revisions; i++)
      {
-        e_user_dir_snprintf(buf, sizeof(buf), "config/%s/%s.%i.cfg",
+        e_user_dir_snprintf(buf, sizeof(buf), "config/%s/%s.cfg.%i",
                             _e_config_profile, domain, i);
         ef = eet_open(buf, EET_FILE_MODE_READ);
         if (ef)
           {
+             printf("CF: warning - falling back to %s\n", buf);
              data = "" edd, "config");
              eet_close(ef);
              if (data) return data;
+             printf("CF: warning - fallback to %s can't read config\n", buf);
           }
+        else if (ecore_file_exists(buf))
+          printf("CF: warning - fallback to %s failing to open\n", buf);
      }
+   printf("CF: fallback to system config config file for [%s]\n", domain);
    return e_config_domain_system_load(domain, edd);
 }
 
@@ -2204,6 +2234,7 @@ e_config_domain_system_load(const char *domain, E_Config_DD *edd)
         eet_close(ef);
         return data;
      }
+   printf("CF: system config load for %s failed\n", buf);
 
    return data;
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to