From: Eric Biggers Date: Wed, 16 Sep 2015 06:15:05 +0000 (-0500) Subject: wimlib-imagex: add --ref option to wimdir X-Git-Tag: v1.8.3~110 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=c19e66d9d01eafe0f71c6b7a24b27bf4c8badca1;ds=sidebyside wimlib-imagex: add --ref option to wimdir --- diff --git a/doc/man1/wimlib-imagex-dir.1 b/doc/man1/wimlib-imagex-dir.1 index d8b23edc..0de5a103 100644 --- a/doc/man1/wimlib-imagex-dir.1 +++ b/doc/man1/wimlib-imagex-dir.1 @@ -26,6 +26,11 @@ List detailed information about each file. \fB--one-file-only\fR Show information about one file only. Intended for use with both \fB--path\fR and \fB--detailed\fR. +.TP +\fB--ref\fR="\fIGLOB\fR" +File glob of additional WIMs or split WIM parts to reference resources from. +This option can be specified multiple times. This option is only useful when +\fB--detailed\fR is also specified. .SH NOTES \fBwimlib-imagex dir\fR supports split WIMs, but it will only work on the first part of the split WIM. diff --git a/programs/imagex.c b/programs/imagex.c index 556006f6..3c25d1e1 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -267,6 +267,7 @@ static const struct option dir_options[] = { {T("path"), required_argument, NULL, IMAGEX_PATH_OPTION}, {T("detailed"), no_argument, NULL, IMAGEX_DETAILED_OPTION}, {T("one-file-only"), no_argument, NULL, IMAGEX_ONE_FILE_ONLY_OPTION}, + {T("ref"), required_argument, NULL, IMAGEX_REF_OPTION}, {NULL, 0, NULL, 0}, }; @@ -2639,6 +2640,8 @@ imagex_dir(int argc, tchar **argv, int cmd) }; int iterate_flags = WIMLIB_ITERATE_DIR_TREE_FLAG_RECURSIVE; + STRING_SET(refglobs); + for_opt(c, dir_options) { switch (c) { case IMAGEX_PATH_OPTION: @@ -2650,6 +2653,11 @@ imagex_dir(int argc, tchar **argv, int cmd) case IMAGEX_ONE_FILE_ONLY_OPTION: iterate_flags &= ~WIMLIB_ITERATE_DIR_TREE_FLAG_RECURSIVE; break; + case IMAGEX_REF_OPTION: + ret = string_set_append(&refglobs, optarg); + if (ret) + goto out_free_refglobs; + break; default: goto out_usage; } @@ -2670,7 +2678,7 @@ imagex_dir(int argc, tchar **argv, int cmd) ret = wimlib_open_wim_with_progress(wimfile, 0, &wim, imagex_progress_func, NULL); if (ret) - goto out; + goto out_free_refglobs; if (argc >= 2) { image = wimlib_resolve_image(wim, argv[1]); @@ -2694,17 +2702,24 @@ imagex_dir(int argc, tchar **argv, int cmd) image = 1; } + if (refglobs.num_strings) { + ret = wim_reference_globs(wim, &refglobs, 0); + if (ret) + goto out_wimlib_free; + } + ret = wimlib_iterate_dir_tree(wim, image, path, iterate_flags, print_dentry, &options); out_wimlib_free: wimlib_free(wim); -out: +out_free_refglobs: + string_set_destroy(&refglobs); return ret; out_usage: usage(CMD_DIR, stderr); ret = -1; - goto out; + goto out_free_refglobs; } /* Exports one, or all, images from a WIM file to a new WIM file or an existing