From 59ec635813dfeca9d9b675b26b74cd36a1d17f65 Mon Sep 17 00:00:00 2001 From: Mykyta Biliavskyi Date: Mon, 1 Jun 2015 14:33:10 +0000 Subject: [PATCH] Command arguments: add recognize output file. If command arguments contain path to file with ".edj" extension, this file will be used for store output binary file. Example: enventor --id /path/img --fd /path/fnt input.edc output.edj --- src/bin/config_data.c | 8 +++++--- src/bin/main.c | 28 +++++++++++++++++++--------- src/include/config_data.h | 2 +- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/bin/config_data.c b/src/bin/config_data.c index 869f31c..4d0ae3e 100644 --- a/src/bin/config_data.c +++ b/src/bin/config_data.c @@ -266,9 +266,9 @@ config_edc_path_set(const char *edc_path) } void -config_init(const char *edc_path, Eina_List *edc_img_path, - Eina_List *edc_snd_path, Eina_List *edc_fnt_path, - Eina_List *edc_dat_path) +config_init(const char *edc_path, const char *edj_path, + Eina_List *edc_img_path, Eina_List *edc_snd_path, + Eina_List *edc_fnt_path, Eina_List *edc_dat_path) { Eina_Stringshare *s; eddc_init(); @@ -277,6 +277,8 @@ config_init(const char *edc_path, Eina_List *edc_img_path, g_cd = cd; if (edc_path[0]) config_edc_path_set(edc_path); + if (edj_path[0]) + eina_stringshare_replace(&cd->edj_path, edj_path); if (edc_img_path) g_cd->edc_img_path_list = edc_img_path; diff --git a/src/bin/main.c b/src/bin/main.c index 3ce2919..9f56794 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -285,8 +285,9 @@ tools_set(Evas_Object *enventor) } static Eina_Bool -args_dispatch(int argc, char **argv, char *edc_path, Eina_List **img_path, - Eina_List **snd_path, Eina_List **fnt_path, Eina_List **dat_path, +args_dispatch(int argc, char **argv, char *edc_path, char *edj_path, + Eina_List **img_path, Eina_List **snd_path, + Eina_List **fnt_path, Eina_List **dat_path, Eina_Bool *template_new) { @@ -342,10 +343,18 @@ args_dispatch(int argc, char **argv, char *edc_path, Eina_List **img_path, }; //edc path - if ((argc >= 2) && strstr(argv[1], ".edc")) + int i = 0; + for (; i < argc; i++) { - sprintf(edc_path, "%s", argv[1]); - default_edc = EINA_FALSE; + if (strstr(argv[i], ".edc")) + { + sprintf(edc_path, "%s", argv[i]); + default_edc = EINA_FALSE; + } + else if (strstr(argv[i], ".edj")) + { + sprintf(edj_path, "%s", argv[i]); + } } if ((ecore_getopt_parse(&optdesc, values, argc, argv) < 0) || quit) @@ -402,16 +411,17 @@ static Eina_Bool config_data_set(app_data *ad, int argc, char **argv) { char edc_path[PATH_MAX] = { 0, }; + char edj_path[PATH_MAX] = { 0, }; Eina_List *img_path = NULL; Eina_List *snd_path = NULL; Eina_List *fnt_path = NULL; Eina_List *dat_path = NULL; Eina_Bool template_new = EINA_FALSE; - Eina_Bool default_edc = args_dispatch(argc, argv, edc_path, &img_path, - &snd_path, &fnt_path, &dat_path, - &template_new); - config_init(edc_path, img_path, snd_path, fnt_path, dat_path); + Eina_Bool default_edc = args_dispatch(argc, argv, edc_path, edj_path, + &img_path, &snd_path, &fnt_path, + &dat_path, &template_new); + config_init(edc_path, edj_path, img_path, snd_path, fnt_path, dat_path); config_update_cb_set(config_update_cb, ad); ad->template_new = template_new; diff --git a/src/include/config_data.h b/src/include/config_data.h index 3a8c02c..bd984ce 100644 --- a/src/include/config_data.h +++ b/src/include/config_data.h @@ -3,7 +3,7 @@ #define MAX_VIEW_SCALE 5.0 #define MIN_VIEW_SCALE 0.5 -void config_init(const char *edc_path, Eina_List *edc_img_path, Eina_List *edc_snd_path, Eina_List *edc_fnt_path, Eina_List *edc_dat_path); +void config_init(const char *edc_path, const char *edj_path, Eina_List *edc_img_path, Eina_List *edc_snd_path, Eina_List *edc_fnt_path, Eina_List *edc_dat_path); void config_term(void); const char *config_edc_path_get(void); const char *config_edj_path_get(void);