From 5297c50278a314988921f4e2e23d8bb4153e22a7 Mon Sep 17 00:00:00 2001 From: Pavel Tsekov Date: Tue, 23 May 2006 09:35:06 +0000 Subject: [PATCH] * src/file.c (move_file_file): Do not collect progress information when moving via copy/erase - copy_file_file() does that already. Collect progress information when moving via rename (). --- src/ChangeLog | 6 ++++++ src/file.c | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 1457edff0..9db1f5451 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2006-05-23 Hampa Hug + + * file.c (move_file_file): Do not collect progress information + when moving via copy/erase - copy_file_file() does that. + Collect progress information when moving via rename (). + 2006-05-23 Pavel Tsekov * tty.c (tty_tgetstr) [HAVE_SLANG]: str_unconst() the argument diff --git a/src/file.c b/src/file.c index 017ff2d44..74d3c0f6e 100644 --- a/src/file.c +++ b/src/file.c @@ -1022,6 +1022,7 @@ move_file_file (FileOpContext *ctx, const char *s, const char *d, { struct stat src_stats, dst_stats; int return_status = FILE_CONT; + gboolean copy_done = FALSE; if (file_progress_show_source (ctx, s) == FILE_ABORT || file_progress_show_target (ctx, d) == FILE_ABORT) @@ -1080,7 +1081,9 @@ move_file_file (FileOpContext *ctx, const char *s, const char *d, } if (mc_rename (s, d) == 0) { - return FILE_CONT; + return progress_update_one (ctx, progress_count, + progress_bytes, + src_stats.st_size, 1); } } #if 0 @@ -1107,6 +1110,8 @@ move_file_file (FileOpContext *ctx, const char *s, const char *d, if (return_status != FILE_CONT) return return_status; + copy_done = TRUE; + if ((return_status = file_progress_show_source (ctx, NULL)) != FILE_CONT || (return_status = file_progress_show (ctx, 0, 0)) != FILE_CONT) @@ -1123,11 +1128,12 @@ move_file_file (FileOpContext *ctx, const char *s, const char *d, return return_status; } - if (return_status == FILE_CONT) + if (!copy_done) { return_status = progress_update_one (ctx, progress_count, progress_bytes, src_stats.st_size, 1); + } return return_status; }