allow the user to chose in which directory the temporary file
will be created. The logic is the following: * if the environment variable TMPDIR is set, use its value * if it is not set, take the directory passed with the -td option (see edje_cc help) * otherwise on Windows use a temporary dir and on other platform, use /tmp SVN revision: 41978
This commit is contained in:
parent
ea9c39e2f7
commit
2a8d44f5a0
|
@ -16,6 +16,7 @@ Eina_List *img_dirs = NULL;
|
||||||
Eina_List *fnt_dirs = NULL;
|
Eina_List *fnt_dirs = NULL;
|
||||||
Eina_List *defines = NULL;
|
Eina_List *defines = NULL;
|
||||||
char *file_in = NULL;
|
char *file_in = NULL;
|
||||||
|
char *tmp_dir = NULL;
|
||||||
char *file_out = NULL;
|
char *file_out = NULL;
|
||||||
char *progname = NULL;
|
char *progname = NULL;
|
||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
|
@ -37,6 +38,7 @@ main_help(void)
|
||||||
"\n"
|
"\n"
|
||||||
"-id image/directory Add a directory to look in for relative path images\n"
|
"-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"
|
"-fd font/directory Add a directory to look in for relative path fonts\n"
|
||||||
|
"-td temp/directory Directory to store temporary files\n"
|
||||||
"-v Verbose output\n"
|
"-v Verbose output\n"
|
||||||
"-no-lossy Do NOT allow images to be lossy\n"
|
"-no-lossy Do NOT allow images to be lossy\n"
|
||||||
"-no-comp Do NOT allow images to be stored with lossless compression\n"
|
"-no-comp Do NOT allow images to be stored with lossless compression\n"
|
||||||
|
@ -58,6 +60,9 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
eina_init();
|
eina_init();
|
||||||
|
|
||||||
|
tmp_dir = getenv("TMPDIR");
|
||||||
|
|
||||||
|
|
||||||
progname = argv[0];
|
progname = argv[0];
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
|
@ -92,6 +97,12 @@ main(int argc, char **argv)
|
||||||
i++;
|
i++;
|
||||||
fnt_dirs = eina_list_append(fnt_dirs, argv[i]);
|
fnt_dirs = eina_list_append(fnt_dirs, argv[i]);
|
||||||
}
|
}
|
||||||
|
else if ((!strcmp(argv[i], "-td") || !strcmp(argv[i], "--tmp_dir")) && (i < (argc - 1)))
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
if (!tmp_dir)
|
||||||
|
tmp_dir = argv[i];
|
||||||
|
}
|
||||||
else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1)))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -124,6 +124,7 @@ char *mem_strdup(const char *s);
|
||||||
extern Eina_List *img_dirs;
|
extern Eina_List *img_dirs;
|
||||||
extern Eina_List *fnt_dirs;
|
extern Eina_List *fnt_dirs;
|
||||||
extern char *file_in;
|
extern char *file_in;
|
||||||
|
extern char *tmp_dir;
|
||||||
extern char *file_out;
|
extern char *file_out;
|
||||||
extern char *progname;
|
extern char *progname;
|
||||||
extern int verbose;
|
extern int verbose;
|
||||||
|
|
|
@ -762,10 +762,11 @@ data_write_scripts(Eet_File *ef)
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (!tmp_dir)
|
||||||
#ifdef HAVE_EVIL
|
#ifdef HAVE_EVIL
|
||||||
char *tmpdir = evil_tmpdir_get();
|
tmp_dir = evil_tmpdir_get();
|
||||||
#else
|
#else
|
||||||
char *tmpdir = "/tmp";
|
tmp_dir = "/tmp";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0, l = codes; l; l = eina_list_next(l), i++)
|
for (i = 0, l = codes; l; l = eina_list_next(l), i++)
|
||||||
|
@ -779,7 +780,8 @@ data_write_scripts(Eet_File *ef)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
char tmpn[4096];
|
char tmpn[4096];
|
||||||
snprintf(tmpn, PATH_MAX, "%s/edje_cc.sma-tmp-XXXXXX", tmpdir);
|
snprintf(tmpn, PATH_MAX, "%s/edje_cc.sma-tmp-XXXXXX", tmp_dir);
|
||||||
|
printf("%s\n", tmpn);
|
||||||
fd = mkstemp(tmpn);
|
fd = mkstemp(tmpn);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
error_and_abort(ef, "Unable to open temp file \"%s\" for script "
|
error_and_abort(ef, "Unable to open temp file \"%s\" for script "
|
||||||
|
@ -789,7 +791,8 @@ data_write_scripts(Eet_File *ef)
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
char tmpo[4096];
|
char tmpo[4096];
|
||||||
snprintf(tmpo, PATH_MAX, "%s/edje_cc.amx-tmp-XXXXXX", tmpdir);
|
snprintf(tmpo, PATH_MAX, "%s/edje_cc.amx-tmp-XXXXXX", tmp_dir);
|
||||||
|
printf("%s\n", tmpn);
|
||||||
fd = mkstemp(tmpo);
|
fd = mkstemp(tmpo);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -641,12 +641,12 @@ compile(void)
|
||||||
int fd;
|
int fd;
|
||||||
off_t size;
|
off_t size;
|
||||||
char *data, *p;
|
char *data, *p;
|
||||||
const char *tmpdir;
|
|
||||||
|
|
||||||
|
if (!tmp_dir)
|
||||||
#ifdef HAVE_EVIL
|
#ifdef HAVE_EVIL
|
||||||
tmpdir = evil_tmpdir_get();
|
tmp_dir = evil_tmpdir_get();
|
||||||
#else
|
#else
|
||||||
tmpdir = "/tmp";
|
tmp_dir = "/tmp";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
strncpy(inc, file_in, 4000);
|
strncpy(inc, file_in, 4000);
|
||||||
|
@ -654,7 +654,8 @@ compile(void)
|
||||||
p = strrchr(inc, '/');
|
p = strrchr(inc, '/');
|
||||||
if (!p) strcpy(inc, "./");
|
if (!p) strcpy(inc, "./");
|
||||||
else *p = 0;
|
else *p = 0;
|
||||||
snprintf (tmpn, PATH_MAX, "%s/edje_cc.edc-tmp-XXXXXX", tmpdir);
|
snprintf (tmpn, PATH_MAX, "%s/edje_cc.edc-tmp-XXXXXX", tmp_dir);
|
||||||
|
printf("%s\n", tmpn);
|
||||||
fd = mkstemp(tmpn);
|
fd = mkstemp(tmpn);
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue