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:
Hannes Janetzek 2010-05-25 02:45:00 +00:00
parent 6452707656
commit 4f06333e2a
2 changed files with 11 additions and 2 deletions

View File

@ -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;

View File

@ -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)