diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c index 9627d47977..87412158a2 100644 --- a/src/lib/elementary/elm_config.c +++ b/src/lib/elementary/elm_config.c @@ -6,6 +6,7 @@ #include "elm_priv.h" #include +#include "../../static_libs/buildsystem/buildsystem.h" #include "efl_config_global.eo.h" EAPI int ELM_EVENT_CONFIG_ALL_CHANGED = 0; @@ -965,7 +966,8 @@ _elm_config_profile_dir_get(const char *prof, if (!is_user) goto not_user; - _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/%s", prof); + if ((!_use_build_config) || (!bs_data_path_get(buf, sizeof(buf), "elementary/config", prof))) + _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/%s", prof); // See elm_config_profile_dir_free: always use strdup+free if (ecore_file_is_dir(buf)) @@ -974,7 +976,8 @@ _elm_config_profile_dir_get(const char *prof, return NULL; not_user: - snprintf(buf, sizeof(buf), "%s/config/%s", _elm_data_dir, prof); + if ((!_use_build_config) || (!bs_data_path_get(buf, sizeof(buf), "elementary/config", prof))) + snprintf(buf, sizeof(buf), "%s/config/%s", _elm_data_dir, prof); // See elm_config_profile_dir_free: always use strdup+free if (ecore_file_is_dir(buf)) @@ -1356,9 +1359,15 @@ _elm_config_profiles_list(Eina_Bool hide_profiles) Eina_Iterator *file_it; char buf[PATH_MAX]; const char *dir; - size_t len; + size_t len = 0; - len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "config"); + if (_use_build_config) + { + len = bs_data_path_get(buf, sizeof(buf), "elementary", "config"); + if (len) len = strlen(buf); + } + if (!len) + len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "config"); file_it = eina_file_stat_ls(buf); if (!file_it) goto sys; @@ -2083,7 +2092,7 @@ _elm_config_profile_save(const char *profile) Eet_File *ef; size_t len; - if ((s = getenv("ELM_PROFILE_NOSAVE")) && atoi(s)) + if (_use_build_config || ((s = getenv("ELM_PROFILE_NOSAVE")) && atoi(s))) return EINA_TRUE; len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg"); @@ -3002,6 +3011,11 @@ elm_config_profile_exists(const char *profile) if (!profile) return EINA_FALSE; + if (_use_build_config) + { + if (!bs_data_path_get(buf, sizeof(buf), "elementary/config", profile)) return EINA_FALSE; + return ecore_file_exists(buf); + } _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/%s/base.cfg", profile); if (ecore_file_exists(buf)) return EINA_TRUE; @@ -4094,6 +4108,7 @@ elm_config_all_flush(void) int ok = 0; size_t len; + if (_use_build_config) return; len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "themes/"); if (len + 1 >= sizeof(buf)) return; @@ -4200,6 +4215,7 @@ _elm_config_sub_shutdown(void) ELM_SAFE_FREE(_monitor_file_created_handler, ecore_event_handler_del); ELM_SAFE_FREE(_monitor_file_modified_handler, ecore_event_handler_del); ELM_SAFE_FREE(_monitor_directory_created_handler, ecore_event_handler_del); + _use_build_config = EINA_FALSE; } static Eina_Bool @@ -4291,8 +4307,13 @@ _elm_config_sub_init(void) char buf[PATH_MAX]; int ok = 0; - _elm_config_user_dir_snprintf(buf, sizeof(buf), "config"); - ok = ecore_file_mkpath(buf); + if (_use_build_config) + ok = bs_data_path_get(buf, sizeof(buf), "elementary", "config"); + else + { + _elm_config_user_dir_snprintf(buf, sizeof(buf), "config"); + ok = ecore_file_mkpath(buf); + } if (!ok) { ERR("Problem accessing Elementary's user configuration directory: %s",