]> wimlib.net Git - wimlib/commitdiff
wimlib-imagex: add --ref option to wimdir
authorEric Biggers <ebiggers3@gmail.com>
Wed, 16 Sep 2015 06:15:05 +0000 (01:15 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 19 Sep 2015 16:36:30 +0000 (11:36 -0500)
doc/man1/wimlib-imagex-dir.1
programs/imagex.c

index d8b23edcafef83401e112192d256203bfc46bf0d..0de5a1039bb6e2ac7bdec2d2f2f9609138190e25 100644 (file)
@@ -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.
index 556006f6e82b4ea61551c805aa6b2bd9b0919c48..3c25d1e1c79dbb443941c9ef5b590b45291dacd8 100644 (file)
@@ -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