diff options
author | Eduardo Lima (Etrunko) <eduardo.lima@intel.com> | 2013-06-04 13:09:56 -0300 |
---|---|---|
committer | Eduardo Lima (Etrunko) <eduardo.lima@intel.com> | 2013-06-04 17:39:30 -0300 |
commit | a346c834c127577e74ae28e6089effd7853a220c (patch) | |
tree | 96a566fd637c937e99b6a091dcbff8eb4da60c91 | |
parent | 383bb37e61b94fcd621f24e53999142551ae3880 (diff) |
edje_cc: Add -dd/--data_dir option
Used for specifying the path of files specified in 'data.file' section
Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
-rw-r--r-- | src/bin/edje/edje_cc.c | 7 | ||||
-rw-r--r-- | src/bin/edje/edje_cc.h | 1 | ||||
-rw-r--r-- | src/bin/edje/edje_cc_handlers.c | 19 |
3 files changed, 24 insertions, 3 deletions
diff --git a/src/bin/edje/edje_cc.c b/src/bin/edje/edje_cc.c index f336f58c6..1ce51689c 100644 --- a/src/bin/edje/edje_cc.c +++ b/src/bin/edje/edje_cc.c @@ -15,6 +15,7 @@ Eina_Prefix *pfx = NULL; Eina_List *snd_dirs = NULL; Eina_List *img_dirs = NULL; Eina_List *fnt_dirs = NULL; +Eina_List *data_dirs = NULL; Eina_List *defines = NULL; char *file_in = NULL; char *tmp_dir = NULL; @@ -87,6 +88,7 @@ main_help(void) "-id image/directory Add a directory to look in for relative path images\n" "-fd font/directory Add a directory to look in for relative path fonts\n" "-sd sound/directory Add a directory to look in for relative path sounds samples\n" + "-dd data/directory Add a directory to look in for relative path data.file entries\n" "-td temp/directory Directory to store temporary files\n" "-v Verbose output\n" "-no-lossy Do NOT allow images to be lossy\n" @@ -179,6 +181,11 @@ main(int argc, char **argv) i++; snd_dirs = eina_list_append(snd_dirs, argv[i]); } + else if ((!strcmp(argv[i], "-dd") || !strcmp(argv[i], "--data_dir")) && (i < (argc - 1))) + { + i++; + data_dirs = eina_list_append(data_dirs, argv[i]); + } else if ((!strcmp(argv[i], "-td") || !strcmp(argv[i], "--tmp_dir")) && (i < (argc - 1))) { i++; diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h index accccd060..cfb6271de 100644 --- a/src/bin/edje/edje_cc.h +++ b/src/bin/edje/edje_cc.h @@ -220,6 +220,7 @@ extern Eina_List *ext_dirs; extern Eina_List *img_dirs; extern Eina_List *fnt_dirs; extern Eina_List *snd_dirs; +extern Eina_List *data_dirs; extern char *file_in; extern char *tmp_dir; extern char *file_out; diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index 1738bebe6..9ebf19d4d 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c @@ -1823,9 +1823,22 @@ st_data_file(void) fd = open(filename, O_RDONLY | O_BINARY, S_IRUSR | S_IWUSR); if (fd < 0) { - ERR("%s:%i when opening file \"%s\": \"%s\"", - file_in, line, filename, strerror(errno)); - exit(-1); + char path[PATH_MAX], *dir; + Eina_List *l; + EINA_LIST_FOREACH(data_dirs, l, dir) + { + snprintf(path, sizeof(path), "%s/%s", dir, filename); + fd = open(path, O_RDONLY | O_BINARY, S_IRUSR | S_IWUSR); + if (fd >= 0) + break; + } + + if (fd < 0) + { + ERR("%s:%i when opening file \"%s\": \"%s\"", + file_in, line, filename, strerror(errno)); + exit(-1); + } } if (fstat(fd, &buf)) |