hermet pushed a commit to branch master. http://git.enlightenment.org/tools/enventor.git/commit/?id=af56cdb083f23d514dc975dd64862514594aea8b
commit af56cdb083f23d514dc975dd64862514594aea8b Author: Mykyta Biliavskyi <m.biliavs...@samsung.com> Date: Tue Jun 2 10:03:25 2015 +0000 Support version fo the enventor config file. Config data is checked on the versiob of config file. if the version is lower than current, then don't read the config data and instead open with default. On enventor close, config file is rewrited with new data. --- src/bin/config_data.c | 13 ++++++++++++- src/include/common.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/bin/config_data.c b/src/bin/config_data.c index 4d0ae3e..a0ec542 100644 --- a/src/bin/config_data.c +++ b/src/bin/config_data.c @@ -18,6 +18,7 @@ typedef struct config_s Eina_List *syntax_color_list; + unsigned int version; float font_scale; double view_scale; double console_size; @@ -133,7 +134,7 @@ config_load(void) } else EINA_LOG_WARN("Cannot load a config file \"%s\"", buf); - //failed to load config file. set default values. + //failed to load config file, create default structure. if (!cd) { cd = calloc(1, sizeof(config_data)); @@ -142,6 +143,14 @@ config_load(void) EINA_LOG_ERR("Failed to allocate Memory!"); return NULL; } + } + // loaded config is not compatile with current version of Enventor + if (cd->version < ENVENTOR_CONFIG_VERSION) + { + cd->edc_img_path_list = NULL; + cd->edc_snd_path_list = NULL; + cd->edc_fnt_path_list = NULL; + cd->edc_dat_path_list = NULL; cd->font_scale = 1.0f; cd->view_scale = 1; cd->console_size = DEFAULT_CONSOLE_SIZE; @@ -154,6 +163,7 @@ config_load(void) cd->console = EINA_TRUE; cd->auto_complete = EINA_TRUE; cd->view_size_configurable = EINA_FALSE; + cd->version = ENVENTOR_CONFIG_VERSION; } g_cd = cd; @@ -218,6 +228,7 @@ eddc_init(void) "edc_dat_path_list", edc_dat_path_list); EET_DATA_DESCRIPTOR_ADD_LIST_STRING(edd_base, config_data, "syntax_color_list", syntax_color_list); + EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "version", version, EET_T_UINT); EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "font_name", font_name, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "font_style", font_style, diff --git a/src/include/common.h b/src/include/common.h index 699b9dc..b68d5cf 100644 --- a/src/include/common.h +++ b/src/include/common.h @@ -55,6 +55,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" #define REL2_X 0.75f #define REL2_Y 0.75f +#define ENVENTOR_CONFIG_VERSION 1 + #define ENVENTOR_BETA_API_SUPPORT 1 #include <Enventor.h> #include <assert.h> --