edje: edje_decc - added -output flag (save to specified dir)

Reviewers: cedric, seoz

Reviewed By: cedric

CC: reutskiy.v.v, cedric

Differential Revision: https://phab.enlightenment.org/D402

Signed-off-by: Cedric BAIL <cedric.bail@samsung.com>
This commit is contained in:
Andrii Kroitor 2013-12-23 10:48:08 +09:00 committed by Cedric BAIL
parent 641d823cbb
commit 574c5c1ba7
1 changed files with 23 additions and 13 deletions

View File

@ -22,6 +22,7 @@ int _edje_cc_log_dom = -1;
static const char *progname = NULL; static const char *progname = NULL;
char *file_in = NULL; char *file_in = NULL;
char *file_out = NULL; char *file_out = NULL;
char *outdir = NULL;
int compress_mode = EET_COMPRESSION_DEFAULT; int compress_mode = EET_COMPRESSION_DEFAULT;
Edje_File *edje_file = NULL; Edje_File *edje_file = NULL;
@ -123,10 +124,11 @@ main_help(void)
{ {
printf printf
("Usage:\n" ("Usage:\n"
"\t%s input_file.edj [-main-out file.edc] [-no-build-sh] [-current-dir]\n" "\t%s input_file.edj [-main-out file.edc] [-no-build-sh] [-current-dir | -output path_to_dir]\n"
"\n" "\n"
" -main-out\tCreate a symbolic link to the main edc \n" " -main-out\tCreate a symbolic link to the main edc \n"
" -no-build-sh\tDon't output build.sh \n" " -no-build-sh\tDon't output build.sh \n"
" -output, -o\tOutput to specified directory \n"
" -current-dir\tOutput to current directory \n" " -current-dir\tOutput to current directory \n"
" -quiet\t\tProduce less output\n" " -quiet\t\tProduce less output\n"
"\n" "\n"
@ -179,6 +181,11 @@ main(int argc, char **argv)
new_dir = 0; new_dir = 0;
else if (!strcmp(argv[i], "-quiet")) else if (!strcmp(argv[i], "-quiet"))
eina_log_domain_level_set("edje_decc", EINA_LOG_LEVEL_WARN); eina_log_domain_level_set("edje_decc", EINA_LOG_LEVEL_WARN);
else if ((!strcmp(argv[i], "-o") || !strcmp(argv[i], "-output")) && (i < (argc - 1)))
{
i++;
outdir = strdup(argv[i]);
}
} }
if (!file_in) if (!file_in)
{ {
@ -257,20 +264,23 @@ output(void)
Eina_List *l; Eina_List *l;
Eet_File *tef; Eet_File *tef;
SrcFile *sf; SrcFile *sf;
char *outdir, *p; char *p;
if (!new_dir) if (!outdir)
outdir = strdup(".");
else
{ {
p = strrchr(file_in, '/'); if (!new_dir)
if (p) outdir = strdup(".");
outdir = strdup(p + 1); else
else {
outdir = strdup(file_in); p = strrchr(file_in, '/');
p = strrchr(outdir, '.'); if (p)
if (p) *p = 0; outdir = strdup(p + 1);
ecore_file_mkpath(outdir); else
outdir = strdup(file_in);
p = strrchr(outdir, '.');
if (p) *p = 0;
ecore_file_mkpath(outdir);
}
} }