forked from enlightenment/enlightenment
patch from T_UNIX:
theme import: unlink existing theme file before replacing with new wallpaper import: dont try filenames to infinity SVN revision: 49193
This commit is contained in:
parent
6452707656
commit
4f06333e2a
|
@ -267,6 +267,9 @@ _theme_import_cb_ok(void *data, void *data2)
|
|||
file = ecore_file_file_get(import->cfdata->file);
|
||||
e_user_dir_snprintf(buf, sizeof(buf), "themes/%s", file);
|
||||
|
||||
if (ecore_file_exists(buf))
|
||||
ecore_file_unlink(buf);
|
||||
|
||||
strip = ecore_file_strip_ext(file);
|
||||
if (!strip)
|
||||
return;
|
||||
|
|
|
@ -450,12 +450,18 @@ _import_edj_gen(Import *import)
|
|||
len = e_user_dir_snprintf(buf, sizeof(buf), "backgrounds/%s.edj", fstrip);
|
||||
if (len >= sizeof(buf)) return;
|
||||
off = len - (sizeof(".edj") - 1);
|
||||
while (ecore_file_exists(buf))
|
||||
for (num = 1; ecore_file_exists(buf) && num < 100; num++)
|
||||
{
|
||||
snprintf(buf + off, sizeof(buf) - off, "-%d.edj", num);
|
||||
num++;
|
||||
}
|
||||
free(fstrip);
|
||||
|
||||
if (num == 100)
|
||||
{
|
||||
printf("Couldn't come up with another filename for %s\n", buf);
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(tmpn, "/tmp/e_bgdlg_new.edc-tmp-XXXXXX");
|
||||
fd = mkstemp(tmpn);
|
||||
if (fd < 0)
|
||||
|
|
Loading…
Reference in New Issue