From f3794f3cb3fb5d90e0e712008e524baf71818fce Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 28 Dec 2013 11:12:31 -0600 Subject: [PATCH] Tweak progress messages --- include/wimlib.h | 7 ++++--- programs/imagex.c | 21 ++++++++++++--------- src/extract.c | 9 ++++++--- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/include/wimlib.h b/include/wimlib.h index f627044f..9bd9ac10 100644 --- a/include/wimlib.h +++ b/include/wimlib.h @@ -440,8 +440,8 @@ enum wimlib_progress_msg { * ::wimlib_progress_info.extract. */ WIMLIB_PROGRESS_MSG_EXTRACT_IMAGE_BEGIN = 0, - /** A file or directory tree within a WIM image (not the full image) is - * about to be extracted. @p info will point to + /** One or more file or directory trees within a WIM image (not the full + * image) is about to be extracted. @p info will point to * ::wimlib_progress_info.extract. */ WIMLIB_PROGRESS_MSG_EXTRACT_TREE_BEGIN, @@ -693,7 +693,8 @@ union wimlib_progress_info { /** Path to the root dentry within the WIM for the tree that is * being extracted. Will be the empty string when extracting a - * full image. */ + * full image, or when extracting a set of paths using + * wimlib_extract_paths() or wimlib_extract_pathlist(). */ const wimlib_tchar *extract_root_wim_source_path; /** Currently only used for diff --git a/programs/imagex.c b/programs/imagex.c index 92e64ee7..5f2bd7b5 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -1079,7 +1079,7 @@ report_scan_progress(const struct wimlib_progress_info_scan *scan, bool done) unit_shift = get_unit(scan->num_bytes_scanned, &unit_name); imagex_printf(T("\r%"PRIu64" %"TS" scanned (%"PRIu64" files, " - "%"PRIu64" directories)"), + "%"PRIu64" directories) "), scan->num_bytes_scanned >> unit_shift, unit_name, scan->num_nondirs_scanned, @@ -1205,14 +1205,17 @@ imagex_progress_func(enum wimlib_progress_msg msg, info->extract.target); break; case WIMLIB_PROGRESS_MSG_EXTRACT_TREE_BEGIN: - imagex_printf(T("Extracting " - "\""WIMLIB_WIM_PATH_SEPARATOR_STRING"%"TS"\" from image %d (\"%"TS"\") " - "in \"%"TS"\" to \"%"TS"\"\n"), - info->extract.extract_root_wim_source_path, - info->extract.image, - info->extract.image_name, - info->extract.wimfile_name, - info->extract.target); + if (info->extract.extract_root_wim_source_path[0] != T('\0')) { + imagex_printf(T("Extracting " + "\""WIMLIB_WIM_PATH_SEPARATOR_STRING"%"TS"\" " + "from image %d (\"%"TS"\") " + "in \"%"TS"\" to \"%"TS"\"\n"), + info->extract.extract_root_wim_source_path, + info->extract.image, + info->extract.image_name, + info->extract.wimfile_name, + info->extract.target); + } break; case WIMLIB_PROGRESS_MSG_EXTRACT_STREAMS: percent_done = TO_PERCENT(info->extract.completed_bytes, diff --git a/src/extract.c b/src/extract.c index abce21f0..c53515d6 100644 --- a/src/extract.c +++ b/src/extract.c @@ -2391,9 +2391,12 @@ extract_trees(WIMStruct *wim, struct wim_dentry **trees, size_t num_trees, } if (progress_func) { - progress_func(*wim_source_path ? WIMLIB_PROGRESS_MSG_EXTRACT_TREE_BEGIN : - WIMLIB_PROGRESS_MSG_EXTRACT_IMAGE_BEGIN, - &ctx.progress); + int msg; + if (*wim_source_path || (extract_flags & WIMLIB_EXTRACT_FLAG_PATHMODE)) + msg = WIMLIB_PROGRESS_MSG_EXTRACT_TREE_BEGIN; + else + msg = WIMLIB_PROGRESS_MSG_EXTRACT_IMAGE_BEGIN; + progress_func(msg, &ctx.progress); } if (!ctx.root_dentry_is_special) -- 2.43.0