]> wimlib.net Git - wimlib/commitdiff
Move default capture config policy to library users
authorEric Biggers <ebiggers3@gmail.com>
Tue, 5 Mar 2013 21:14:22 +0000 (15:14 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 5 Mar 2013 21:14:22 +0000 (15:14 -0600)
programs/imagex.c
src/add_image.c
src/wimlib.h

index e7ebc2eb33e54b80ae54c237a25cde213daacf88..eb2e442f960048612d08d24cc4126e0331e089f8 100644 (file)
@@ -280,6 +280,21 @@ static off_t file_get_size(const char *filename)
                return (off_t)-1;
 }
 
+static const char *default_capture_config =
+"[ExclusionList]\n"
+"\\$ntfs.log\n"
+"\\hiberfil.sys\n"
+"\\pagefile.sys\n"
+"\\System Volume Information\n"
+"\\RECYCLER\n"
+"\\Windows\\CSC\n"
+"\n"
+"[CompressionExclusionList]\n"
+"*.mp3\n"
+"*.zip\n"
+"*.cab\n"
+"\\WINDOWS\\inf\\*.pnf\n";
+
 static char *file_get_contents(const char *filename, size_t *len_ret)
 {
        struct stat stbuf;
@@ -769,8 +784,10 @@ static int imagex_capture_or_append(int argc, const char **argv)
                }
        }
 
-       ret = wimlib_add_image(w, source, name, config_str, config_len,
-                              add_image_flags, imagex_progress_func);
+       ret = wimlib_add_image(w, source, name,
+                              config_str ? config_str : default_capture_config,
+                              config_len, add_image_flags,
+                              imagex_progress_func);
 
        if (ret != 0)
                goto out;
index 3e604e3afc6a2d08c52b68ce5a31987a622195f2..61ed013225ef696fc009228c2964eea3b2ea5d07 100644 (file)
@@ -396,8 +396,13 @@ enum pattern_type {
        ALIGNMENT_LIST,
 };
 
+#define COMPAT_DEFAULT_CONFIG
+
 /* Default capture configuration file when none is specified. */
 static const char *default_config =
+#ifdef COMPAT_DEFAULT_CONFIG /* XXX: This policy is being moved to library
+                               users.  The next ABI-incompatible library
+                               version will default to the empty string here. */
 "[ExclusionList]\n"
 "\\$ntfs.log\n"
 "\\hiberfil.sys\n"
@@ -411,6 +416,9 @@ static const char *default_config =
 "*.zip\n"
 "*.cab\n"
 "\\WINDOWS\\inf\\*.pnf\n";
+#else
+"";
+#endif
 
 static void destroy_pattern_list(struct pattern_list *list)
 {
@@ -583,21 +591,6 @@ static bool match_pattern(const char *path, const char *path_basename,
        return false;
 }
 
-static void print_pattern_list(const struct pattern_list *list)
-{
-       for (size_t i = 0; i < list->num_pats; i++)
-               printf("    %s\n", list->pats[i]);
-}
-
-static void print_capture_config(const struct capture_config *config)
-{
-       if (config->exclusion_list.num_pats) {
-               puts("Files or folders excluded from image capture:");
-               print_pattern_list(&config->exclusion_list);
-               putchar('\n');
-       }
-}
-
 /* Return true if the image capture configuration file indicates we should
  * exclude the filename @path from capture.
  *
@@ -694,7 +687,6 @@ WIMLIBAPI int wimlib_add_image(WIMStruct *w, const char *source,
        ret = init_capture_config(config_str, config_len, source, &config);
        if (ret != 0)
                return ret;
-       print_capture_config(&config);
 
        DEBUG("Allocating security data");
 
index d1ee1221a3a3790b85fadb9d4920e83ee94a6b76..62a028de0b1c7a75208b7ae36f4969b084910ecd 100644 (file)
@@ -809,8 +809,8 @@ enum wimlib_error_code {
  *     NULL, a default string is used.  Please see the manual page for
  *     <b>imagex capture</b> for more information.
  * @param config_len
- *     Length of the string @a config in bytes.  Ignored if @a config is @c
- *     NULL.
+ *     Length of the string @a config in bytes, not including an optional
+ *     null-terminator.  Ignored if @a config is @c NULL.
  * @param add_image_flags
  *     Bitwise OR of flags prefixed with WIMLIB_ADD_IMAGE_FLAG.
  * @param progress_func