if (!sd) return;
sd->rename_dialogs = eina_list_remove(sd->rename_dialogs, data);
e_fm2_op_registry_entry_unref(ere);
+ _e_fm_client_send(E_FM_OP_OVERWRITE_RESPONSE_NO, ere->id, NULL, 0);
}
static void
E_OBJECT(ed)->data = ere;
e_fm2_op_registry_entry_ref(ere);
_e_fm2_op_registry_go_on(id);
- _e_fm_client_send(E_FM_OP_OVERWRITE_RESPONSE_NO, id, NULL, 0);
}
static void
static void _e_fm_op_random_buf(char *buf, ssize_t len);
static void _e_fm_op_random_char(char *buf, size_t len);
+static int _e_fm_op_make_copy_name(const char *abs, char *buf, size_t buf_size);
+
Eina_List *_e_fm_op_work_queue = NULL, *_e_fm_op_scan_queue = NULL;
Ecore_Idler *_e_fm_op_work_idler_p = NULL, *_e_fm_op_scan_idler_p = NULL;
{
const char *name;
size_t name_len;
+ char *dir;
+ int r;
+ Eina_Bool make_copy;
/* Don't move a dir into itself */
if (ecore_file_is_dir(argv[i]) &&
(strcmp(argv[i], p2) == 0))
goto skip_arg;
+ make_copy = EINA_FALSE;
+ /* Don't move/rename/symlink into same directory
+ * in case of copy, make copy name automatically */
+ dir = ecore_file_dir_get(argv[i]);
+ if (dir)
+ {
+ r = (strcmp(dir, p2) == 0);
+ E_FREE(dir);
+ if (r)
+ {
+ if (type == E_FM_OP_COPY) make_copy = EINA_TRUE;
+ else goto skip_arg;
+ }
+ }
+
name = ecore_file_file_get(argv[i]);
if (!name) goto skip_arg;
name_len = strlen(name);
if (p2_len + name_len >= PATH_MAX) goto skip_arg;
memcpy(p3, name, name_len + 1);
+ if (make_copy)
+ {
+ if (_e_fm_op_make_copy_name(buf, p3, PATH_MAX - p2_len - 1))
+ goto skip_arg;
+ }
if ((type == E_FM_OP_SYMLINK) &&
(symlink(argv[i], buf) == 0))
}
}
+static int
+_e_fm_op_make_copy_name(const char *abs, char *buf, size_t buf_size)
+{
+ size_t name_len;
+ size_t file_len;
+ char *name;
+ char *ext;
+ char *copy_str;
+
+ if (!ecore_file_exists(abs))
+ return 0;
+
+ file_len = strlen(buf);
+
+ /* TODO: need to make a policy regarding copy postfix:
+ * currently attach " (copy)" continuasly
+ *
+ * TODO: i18n */
+ copy_str = "(copy)";
+ if (strlen(copy_str) + file_len + 1 >= buf_size) return 1;
+
+ name = ecore_file_strip_ext(buf);
+ name_len = strlen(name);
+ E_FREE(name);
+
+ if (file_len == name_len) ext = NULL;
+ else ext = strdup(buf + name_len);
+
+ if (ext)
+ {
+ sprintf(buf + name_len, " %s%s", copy_str, ext);
+ E_FREE(ext);
+ }
+ else sprintf(buf + name_len, " %s", copy_str);
+
+ return _e_fm_op_make_copy_name(abs, buf, buf_size);
+}