forked from enlightenment/enlightenment
SVN revision: 75698
SPANK SPANK SPANK, DO NOT COMMIT PATCHES YOU DO NOT UNDERSTAND OR HAVE NOT TESTED. SVN revision: 75988
This commit is contained in:
parent
68ecf550e3
commit
5e7a8a0892
|
@ -66,6 +66,7 @@ static Eina_Bool _e_fm_op_scan_idler(void *data);
|
||||||
|
|
||||||
static void _e_fm_op_send_error(E_Fm_Op_Task *task, E_Fm_Op_Type type, const char *fmt, ...);
|
static void _e_fm_op_send_error(E_Fm_Op_Task *task, E_Fm_Op_Type type, const char *fmt, ...);
|
||||||
static void _e_fm_op_rollback(E_Fm_Op_Task *task);
|
static void _e_fm_op_rollback(E_Fm_Op_Task *task);
|
||||||
|
static void _e_fm_op_update_progress_report_simple(int percent, const char *src, const char *dst);
|
||||||
static void _e_fm_op_update_progress(E_Fm_Op_Task *task, off_t _plus_e_fm_op_done, off_t _plus_e_fm_op_total);
|
static void _e_fm_op_update_progress(E_Fm_Op_Task *task, off_t _plus_e_fm_op_done, off_t _plus_e_fm_op_total);
|
||||||
static void _e_fm_op_copy_stat_info(E_Fm_Op_Task *task);
|
static void _e_fm_op_copy_stat_info(E_Fm_Op_Task *task);
|
||||||
static int _e_fm_op_handle_overwrite(E_Fm_Op_Task *task);
|
static int _e_fm_op_handle_overwrite(E_Fm_Op_Task *task);
|
||||||
|
@ -180,7 +181,7 @@ main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
char *p2, *p3;
|
char *p2, *p3;
|
||||||
size_t p2_len, last_len;
|
int p2_len, last_len, done, total;
|
||||||
|
|
||||||
p2 = ecore_file_realpath(argv[last]);
|
p2 = ecore_file_realpath(argv[last]);
|
||||||
if (!p2) goto quit;
|
if (!p2) goto quit;
|
||||||
|
@ -201,11 +202,14 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
p3 = buf + last_len;
|
p3 = buf + last_len;
|
||||||
|
|
||||||
|
done = 0;
|
||||||
|
total = last - 2;
|
||||||
|
|
||||||
for (; i < last; i++)
|
for (; i < last; i++)
|
||||||
{
|
{
|
||||||
char *p = ecore_file_realpath(argv[i]);
|
char *p = ecore_file_realpath(argv[i]);
|
||||||
const char *name;
|
const char *name;
|
||||||
size_t name_len;
|
int name_len;
|
||||||
|
|
||||||
if (!p) continue;
|
if (!p) continue;
|
||||||
|
|
||||||
|
@ -221,11 +225,19 @@ main(int argc, char **argv)
|
||||||
if (p2_len + name_len >= PATH_MAX) goto skip_arg;
|
if (p2_len + name_len >= PATH_MAX) goto skip_arg;
|
||||||
memcpy(p3, name, name_len + 1);
|
memcpy(p3, name, name_len + 1);
|
||||||
|
|
||||||
|
if ((type == E_FM_OP_SYMLINK) &&
|
||||||
|
(symlink(argv[i], buf) == 0))
|
||||||
|
{
|
||||||
|
done++;
|
||||||
|
_e_fm_op_update_progress_report_simple
|
||||||
|
(done * 100 / total, argv[i], buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if ((type == E_FM_OP_MOVE) &&
|
if ((type == E_FM_OP_MOVE) &&
|
||||||
(!strcmp(argv[i],buf)))
|
(!strcmp(argv[i],buf)))
|
||||||
goto skip_arg;
|
goto skip_arg;
|
||||||
|
|
||||||
/* Creating task */
|
|
||||||
E_Fm_Op_Task *task;
|
E_Fm_Op_Task *task;
|
||||||
|
|
||||||
task = _e_fm_op_task_new();
|
task = _e_fm_op_task_new();
|
||||||
|
@ -235,6 +247,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
_e_fm_op_scan_queue =
|
_e_fm_op_scan_queue =
|
||||||
eina_list_append(_e_fm_op_scan_queue, task);
|
eina_list_append(_e_fm_op_scan_queue, task);
|
||||||
|
}
|
||||||
|
|
||||||
skip_arg:
|
skip_arg:
|
||||||
E_FREE(p);
|
E_FREE(p);
|
||||||
|
@ -255,7 +268,14 @@ skip_arg:
|
||||||
E_FREE(p2);
|
E_FREE(p2);
|
||||||
if (i) goto quit;
|
if (i) goto quit;
|
||||||
|
|
||||||
/* Creating task */
|
if ((type == E_FM_OP_SYMLINK) &&
|
||||||
|
(symlink(argv[2], argv[3]) == 0))
|
||||||
|
{
|
||||||
|
_e_fm_op_update_progress_report_simple(100, argv[2], argv[3]);
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
E_Fm_Op_Task *task;
|
E_Fm_Op_Task *task;
|
||||||
|
|
||||||
task = _e_fm_op_task_new();
|
task = _e_fm_op_task_new();
|
||||||
|
@ -264,6 +284,7 @@ skip_arg:
|
||||||
task->dst.name = eina_stringshare_add(argv[3]);
|
task->dst.name = eina_stringshare_add(argv[3]);
|
||||||
_e_fm_op_scan_queue = eina_list_append(_e_fm_op_scan_queue, task);
|
_e_fm_op_scan_queue = eina_list_append(_e_fm_op_scan_queue, task);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
|
@ -940,6 +961,14 @@ _e_fm_op_update_progress_report(int percent, int eta, double elapsed, off_t done
|
||||||
E_FM_OP_DEBUG("Progress %d. \n", percent);
|
E_FM_OP_DEBUG("Progress %d. \n", percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_e_fm_op_update_progress_report_simple(int percent, const char *src, const char *dst)
|
||||||
|
{
|
||||||
|
size_t done = (percent * REMOVECHUNKSIZE) / 100;
|
||||||
|
_e_fm_op_update_progress_report
|
||||||
|
(percent, 0, 0, done, REMOVECHUNKSIZE, src, dst);
|
||||||
|
}
|
||||||
|
|
||||||
/* Updates progress.
|
/* Updates progress.
|
||||||
* _plus_data is how much more works is done and _plus_e_fm_op_total
|
* _plus_data is how much more works is done and _plus_e_fm_op_total
|
||||||
* is how much more work we found out needs to be done
|
* is how much more work we found out needs to be done
|
||||||
|
|
Loading…
Reference in New Issue