diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h index 74f581d..3d113a6 100644 --- a/src/bin/ephoto.h +++ b/src/bin/ephoto.h @@ -311,11 +311,13 @@ struct _Ephoto_Entry double size; Ephoto *ephoto; Eio_Monitor *monitor; + Eio_Monitor *link_monitor; Eina_List *monitor_handlers; Elm_Object_Item *item; Elm_Object_Item *parent; Eina_List *free_listeners; Eina_Bool is_dir; + Eina_Bool is_link; Eina_Bool no_delete; Evas_Object *genlist; }; diff --git a/src/bin/ephoto_file.c b/src/bin/ephoto_file.c index 4bd280a..7160edf 100644 --- a/src/bin/ephoto_file.c +++ b/src/bin/ephoto_file.c @@ -754,28 +754,37 @@ _delete_thread_cb(void *data, Ecore_Thread *et EINA_UNUSED) { char dest[PATH_MAX], fp[PATH_MAX], extra[PATH_MAX]; int ret; + struct stat s; - snprintf(fp, PATH_MAX, "%s", file); - snprintf(dest, PATH_MAX, "%s/%s", destination, basename(fp)); - if (ecore_file_exists(dest)) - { - snprintf(extra, PATH_MAX, "%s/CopyOf%s", destination, - basename(fp)); - if (ecore_file_exists(extra)) - { - int count; - - for (count = 2; ecore_file_exists(extra); count++) - { - memset(extra, 0, sizeof(extra)); - snprintf(extra, PATH_MAX, "%s/Copy%dOf%s", - destination, count, basename(fp)); - } - } - ret = ecore_file_mv(file, extra); - } + lstat(file, &s); + if (S_ISLNK(s.st_mode)) + { + ret = ecore_file_unlink(file); + } else - ret = ecore_file_mv(file, dest); + { + snprintf(fp, PATH_MAX, "%s", file); + snprintf(dest, PATH_MAX, "%s/%s", destination, basename(fp)); + if (ecore_file_exists(dest)) + { + snprintf(extra, PATH_MAX, "%s/CopyOf%s", destination, + basename(fp)); + if (ecore_file_exists(extra)) + { + int count; + + for (count = 2; ecore_file_exists(extra); count++) + { + memset(extra, 0, sizeof(extra)); + snprintf(extra, PATH_MAX, "%s/Copy%dOf%s", + destination, count, basename(fp)); + } + } + ret = ecore_file_mv(file, extra); + } + else + ret = ecore_file_mv(file, dest); + } if (!ret) ephoto->file_errors++; } diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c index cb5c54f..8b1a581 100644 --- a/src/bin/ephoto_main.c +++ b/src/bin/ephoto_main.c @@ -1088,6 +1088,11 @@ ephoto_entry_new(Ephoto *ephoto, const char *path, const char *label, entry->is_dir = EINA_TRUE; else entry->is_dir = EINA_FALSE; + if (type == EINA_FILE_LNK) + entry->is_link = EINA_TRUE; + else + entry->is_link = EINA_FALSE; + return entry; } @@ -1132,6 +1137,8 @@ ephoto_entry_free(Ephoto *ephoto, Ephoto_Entry *entry) eina_stringshare_del(entry->label); if (entry->monitor) { + if (entry->link_monitor) + eio_monitor_del(entry->link_monitor); eio_monitor_del(entry->monitor); EINA_LIST_FREE(entry->monitor_handlers, handler) ecore_event_handler_del(handler);