jaehwan pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=55d19e1e8cf9a07e9e1c0464284b82fe52b43b5f
commit 55d19e1e8cf9a07e9e1c0464284b82fe52b43b5f Author: Jaehwan Kim <jae.hwan....@samsung.com> Date: Thu Sep 1 14:15:33 2016 +0900 export-edc: add the command option to set the export-edc path. It should set PATH/FOLDER/FILE. If this option is enabled the file browser is not shown and the edc file is exported in the previously set path. @feature --- src/bin/eflete.c | 8 +++++++ src/bin/eflete.h | 5 ++++ src/bin/main.c | 28 +++++++++++++++++++++- .../project_manager/project_manager_export_edc.c | 11 +++++++-- src/bin/ui/menu.c | 5 +++- src/bin/ui/project_export.c | 21 ++++++++++++---- 6 files changed, 70 insertions(+), 8 deletions(-) diff --git a/src/bin/eflete.c b/src/bin/eflete.c index fab8db6..9f79e76 100644 --- a/src/bin/eflete.c +++ b/src/bin/eflete.c @@ -132,6 +132,14 @@ app_shutdown() eina_stringshare_del(ap.path.edj_path); if (ap.path.image_path) eina_stringshare_del(ap.path.image_path); + if (ap.path.export_edj) + eina_stringshare_del(ap.path.export_edj); + if (ap.path.export_edc.path) + eina_stringshare_del(ap.path.export_edc.path); + if (ap.path.export_edc.folder) + eina_stringshare_del(ap.path.export_edc.folder); + if (ap.path.export_edc.file) + eina_stringshare_del(ap.path.export_edc.file); config_shutdown(); elm_theme_free(ap.theme); diff --git a/src/bin/eflete.h b/src/bin/eflete.h index dcaea44..6ada2be 100644 --- a/src/bin/eflete.h +++ b/src/bin/eflete.h @@ -135,6 +135,11 @@ struct _App_Data Eina_Stringshare *image_path; Eina_Stringshare *sound_path; Eina_Stringshare *export_edj; + struct { + Eina_Stringshare *path; + Eina_Stringshare *folder; + Eina_Stringshare *file; + } export_edc; } path; Project *project; Shortcut_Module *shortcuts; /**< Structure with data from shortcuts module */ diff --git a/src/bin/main.c b/src/bin/main.c index 479cd17..c176219 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -32,6 +32,7 @@ static char *file = NULL; static char *pro_name = NULL; static char *pro_path = NULL; static char *export_edj = NULL; +static char *export_edc = NULL; static Eina_List *img_dirs = NULL; static Eina_List *snd_dirs = NULL; static Eina_List *fnt_dirs = NULL; @@ -62,7 +63,8 @@ static const Ecore_Getopt options = { { ECORE_GETOPT_STORE_STR(0, "name", N_("Name for new project")), ECORE_GETOPT_STORE_STR(0, "path", N_("Path to project directory")), - ECORE_GETOPT_STORE_STR(0, "export-edj", N_("Export file path")), + ECORE_GETOPT_STORE_STR(0, "export-edj", N_("Export edj file path")), + ECORE_GETOPT_STORE_STR(0, "export-edc", N_("Export edc file path. This should include the path, folder and edc file name.(PATH/FOLDER/FILE)")), ECORE_GETOPT_APPEND_METAVAR('i', "id", "Add image directory for edc compilation", "DIR_NAME", ECORE_GETOPT_TYPE_STR), ECORE_GETOPT_APPEND_METAVAR('s', "sd", "Add sound directory for edc compilation", "DIR_NAME", ECORE_GETOPT_TYPE_STR), ECORE_GETOPT_APPEND_METAVAR('f', "fd", "Add font directory for edc compilation", "DIR_NAME", ECORE_GETOPT_TYPE_STR), @@ -171,6 +173,28 @@ _new_project(void *data __UNUSED__) tabs_home_tab_add(TAB_HOME_NEW_PROJECT); } +static void +_export_edc_path_set(char *export_edc) +{ + char tmp[256]; + int len = 0, rlen = 0; + + strcpy(tmp, export_edc); + len = strlen(tmp); + rlen = strlen(strrchr(tmp, '/')); + if (!rlen) return; + ap.path.export_edc.file = eina_stringshare_add(tmp + (len - rlen + 1)); + tmp[len - rlen] = '\0'; + + len = strlen(tmp); + rlen = strlen(strrchr(tmp, '/')); + if (!rlen) return; + ap.path.export_edc.folder = eina_stringshare_add(tmp + (len - rlen + 1)); + tmp[len - rlen] = '\0'; + + ap.path.export_edc.path = eina_stringshare_add(tmp); +} + EAPI_MAIN int elm_main(int argc, char **argv) { @@ -183,6 +207,7 @@ elm_main(int argc, char **argv) ECORE_GETOPT_VALUE_STR(pro_name), ECORE_GETOPT_VALUE_STR(pro_path), ECORE_GETOPT_VALUE_STR(export_edj), + ECORE_GETOPT_VALUE_STR(export_edc), ECORE_GETOPT_VALUE_LIST(img_dirs), ECORE_GETOPT_VALUE_LIST(snd_dirs), ECORE_GETOPT_VALUE_LIST(fnt_dirs), @@ -324,6 +349,7 @@ elm_main(int argc, char **argv) run: ap.path.export_edj = export_edj; + _export_edc_path_set(export_edc); if (!ui_main_window_add()) { app_shutdown(); diff --git a/src/bin/project_manager/project_manager_export_edc.c b/src/bin/project_manager/project_manager_export_edc.c index 7a9d831..7a2c29d 100644 --- a/src/bin/project_manager/project_manager_export_edc.c +++ b/src/bin/project_manager/project_manager_export_edc.c @@ -54,6 +54,7 @@ _project_source_code_export_feedback_cb(void *data, void _project_source_code_export_feedback_job(void *data, Ecore_Thread *th) { + Eina_Stringshare *path; Project_Thread *ptd = (Project_Thread *)data; if (!eina_lock_take(&ptd->mutex)) { @@ -65,7 +66,10 @@ _project_source_code_export_feedback_job(void *data, Ecore_Thread *th) Eina_Stringshare *message = eina_stringshare_printf(_("Generate source code ...")); ecore_thread_feedback(th, message); - Eina_Stringshare *path = eina_stringshare_printf("%s/%s", ptd->path, ptd->project->name); + if (!ap.path.export_edc.folder) + path = eina_stringshare_printf("%s/%s", ptd->path, ptd->project->name); + else + path = eina_stringshare_printf("%s/%s", ptd->path, ap.path.export_edc.folder); char *code; Eina_Strbuf *buf; @@ -77,7 +81,10 @@ _project_source_code_export_feedback_job(void *data, Ecore_Thread *th) eina_strbuf_reset(buf); /* create and open edc file for print the source code of collection (project) */ - eina_strbuf_append_printf(buf, "%s/generated.edc", path); + if (!ap.path.export_edc.file) + eina_strbuf_append_printf(buf, "%s/generated.edc", path); + else + eina_strbuf_append_printf(buf, "%s/%s", path, ap.path.export_edc.file); f = fopen(eina_strbuf_string_get(buf), "w"); if (!f) { diff --git a/src/bin/ui/menu.c b/src/bin/ui/menu.c index 367f0cc..7d88ebf 100644 --- a/src/bin/ui/menu.c +++ b/src/bin/ui/menu.c @@ -108,10 +108,13 @@ _menu_cb(void *data __UNUSED__, tabs_home_tab_add(TAB_HOME_IMPORT_EDC); break; case MENU_FILE_SAVE: - project_save(); #if HAVE_TIZEN if (ap.path.export_edj) project_export_develop(); + if (ap.path.export_edc.path && ap.path.export_edc.folder && ap.path.export_edc.file) + project_export_edc_project(); +#else + project_save(); #endif break; case MENU_FILE_EXPORT_EDC_GROUP: diff --git a/src/bin/ui/project_export.c b/src/bin/ui/project_export.c index 11696ec..1e9e4d5 100644 --- a/src/bin/ui/project_export.c +++ b/src/bin/ui/project_export.c @@ -195,20 +195,25 @@ _export_source_code(void *data __UNUSED__, void *event_info) { Eina_List *selected = (Eina_List *)event_info; - Eina_Stringshare *path; + Eina_Stringshare *path, *folder; Eina_Strbuf *buf; assert(selected != NULL); path = eina_stringshare_add((const char *)eina_list_data_get(selected)); buf = eina_strbuf_new(); + if (!ap.path.export_edc.folder) + folder = ap.project->name; + else + folder = ap.path.export_edc.folder; + eina_strbuf_append_printf(buf, _("<font_size=16>A project file '%s/%s' already exist." "Do you want to replace it?</font_size>"), path, - ap.project->name); + folder); if (!exist_permission_check(path, - ap.project->name, + folder, _("Export to develop edj-file"), eina_strbuf_string_get(buf), EINA_FALSE)) return false; @@ -224,7 +229,15 @@ _export_source_code(void *data __UNUSED__, void project_export_edc_project(void) { - popup_fileselector_folder_helper("Export source code", NULL, NULL, _export_source_code, NULL, false, false); + if (!ap.path.export_edc.path) + popup_fileselector_folder_helper("Export source code", NULL, NULL, _export_source_code, NULL, false, false); + else + { + Eina_List *l = NULL; + l = eina_list_append(l, ap.path.export_edc.path); + _export_source_code(NULL, NULL, l); + eina_list_free(l); + } } static Eina_Bool --