]> wimlib.net Git - wimlib/blobdiff - src/capture_common.c
Don't warn about [PrepopulateList] when reading capture config
[wimlib] / src / capture_common.c
index 62ab15b11eef476b6cbf31c6c776d369c61f4e1a..c74c94e05358c50644afdc35f22c16c9f8007241 100644 (file)
@@ -69,19 +69,9 @@ do_capture_progress(struct add_image_params *params, int status,
        }
 }
 
-static int
+int
 mangle_pat(tchar *pat, const tchar *path, unsigned long line_no)
 {
-       /* Remove quotes  */
-       if (pat[0] == T('"') || pat[0] == T('\'')) {
-               tchar quote = pat[0];
-               tchar *last = pat + tstrlen(pat) - 1;
-               if (last > pat && *last == quote) {
-                       tmemmove(pat, pat + 1, last - (pat + 1));
-                       *(last - 1) = T('\0');
-               }
-       }
-
        if (!is_any_path_separator(pat[0]) &&
            pat[0] != T('\0') && pat[1] == T(':'))
        {
@@ -115,23 +105,30 @@ mangle_pat(tchar *pat, const tchar *path, unsigned long line_no)
 }
 
 int
-do_read_capture_config_file(const tchar *config_file, tchar *buf, size_t buflen,
-                           struct capture_config *config)
+do_read_capture_config_file(const tchar *config_file, const void *buf,
+                           size_t bufsize, struct capture_config *config)
 {
        int ret;
+       STRING_SET(prepopulate_pats);
        struct text_file_section sections[] = {
                {T("ExclusionList"),
                        &config->exclusion_pats},
                {T("ExclusionException"),
                        &config->exclusion_exception_pats},
+               {T("PrepopulateList"),
+                       &prepopulate_pats},
        };
+       void *mem;
 
-       ret = do_load_text_file(config_file, buf, buflen, &buf,
-                               sections, ARRAY_LEN(sections), mangle_pat);
+       ret = do_load_text_file(config_file, buf, bufsize, &mem,
+                               sections, ARRAY_LEN(sections),
+                               LOAD_TEXT_FILE_REMOVE_QUOTES, mangle_pat);
        if (ret)
                return ret;
 
-       config->buf = buf;
+       FREE(prepopulate_pats.strings);
+
+       config->buf = mem;
        return 0;
 }
 
@@ -143,7 +140,7 @@ destroy_capture_config(struct capture_config *config)
        FREE(config->buf);
 }
 
-static bool
+bool
 match_pattern(const tchar *path,
              const tchar *path_basename,
              const struct string_set *list)