forked from enlightenment/efl
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>
This commit is contained in:
parent
383bb37e61
commit
a346c834c1
|
@ -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++;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue