forked from enlightenment/enlightenment
E: managing overwrite when moving files
The rename() function deletes dest file if it exists, so there is no overwrite handling. Instead of testing a rename() and if it fails creating a task to copy-delete the file, we directly create this task, which handles overwrite. Patch by Maxime Villard (rustyBSD) SVN revision: 75489
This commit is contained in:
parent
735a1fb7fd
commit
053476d676
|
@ -231,14 +231,7 @@ main(int argc, char **argv)
|
|||
if (p2_len + name_len >= PATH_MAX) goto skip_arg;
|
||||
memcpy(p3, name, name_len + 1);
|
||||
|
||||
if ((type == E_FM_OP_MOVE) &&
|
||||
(rename(argv[i], buf) == 0))
|
||||
{
|
||||
done++;
|
||||
_e_fm_op_update_progress_report_simple
|
||||
(done * 100 / total, argv[i], buf);
|
||||
}
|
||||
else if ((type == E_FM_OP_SYMLINK) &&
|
||||
if ((type == E_FM_OP_SYMLINK) &&
|
||||
(symlink(argv[i], buf) == 0))
|
||||
{
|
||||
done++;
|
||||
|
@ -247,6 +240,10 @@ main(int argc, char **argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((type == E_FM_OP_MOVE) &&
|
||||
(!strcmp(argv[i],buf)))
|
||||
goto skip_arg;
|
||||
|
||||
E_Fm_Op_Task *task;
|
||||
|
||||
task = _e_fm_op_task_new();
|
||||
|
@ -277,13 +274,7 @@ skip_arg:
|
|||
E_FREE(p2);
|
||||
if (i) goto quit;
|
||||
|
||||
/* Try a rename */
|
||||
if ((type == E_FM_OP_MOVE) && (rename(argv[2], argv[3]) == 0))
|
||||
{
|
||||
_e_fm_op_update_progress_report_simple(100, argv[2], argv[3]);
|
||||
goto quit;
|
||||
}
|
||||
else if ((type == E_FM_OP_SYMLINK) &&
|
||||
if ((type == E_FM_OP_SYMLINK) &&
|
||||
(symlink(argv[2], argv[3]) == 0))
|
||||
{
|
||||
_e_fm_op_update_progress_report_simple(100, argv[2], argv[3]);
|
||||
|
|
Loading…
Reference in New Issue