-static bool
-copy_pattern_list(struct wimlib_pattern_list *copy,
- const struct wimlib_pattern_list *list)
-{
- copy->pats = CALLOC(list->num_pats, sizeof(list->pats[0]));
- if (!copy->pats)
- return false;
- copy->num_pats = list->num_pats;
- for (size_t i = 0; i < list->num_pats; i++) {
- copy->pats[i] = TSTRDUP(list->pats[i]);
- if (!copy->pats[i])
- return false;
+ /* [PrepopulateList] is used for apply, not capture. But since we do
+ * understand it, recognize it, thereby avoiding the unrecognized
+ * section warning, but discard the resulting strings.
+ *
+ * We currently ignore [CompressionExclusionList] and
+ * [CompressionFolderList]. This is a known issue that doesn't seem to
+ * have any real consequences, so don't issue warnings about not
+ * recognizing those sections. */
+ STRING_SET(prepopulate_pats);
+ STRING_SET(compression_exclusion_pats);
+ STRING_SET(compression_folder_pats);
+
+ struct text_file_section sections[] = {
+ {T("ExclusionList"),
+ &config->exclusion_pats},
+ {T("ExclusionException"),
+ &config->exclusion_exception_pats},
+ {T("PrepopulateList"),
+ &prepopulate_pats},
+ {T("CompressionExclusionList"),
+ &compression_exclusion_pats},
+ {T("CompressionFolderList"),
+ &compression_folder_pats},
+ };
+ void *mem;
+
+ ret = do_load_text_file(config_file, buf, bufsize, &mem,
+ sections, ARRAY_LEN(sections),
+ LOAD_TEXT_FILE_REMOVE_QUOTES, mangle_pat);
+ if (ret) {
+ ERROR("Failed to load capture configuration file \"%"TS"\"",
+ config_file);
+ switch (ret) {
+ case WIMLIB_ERR_INVALID_UTF8_STRING:
+ case WIMLIB_ERR_INVALID_UTF16_STRING:
+ ERROR("Note: the capture configuration file must be "
+ "valid UTF-8 or UTF-16LE");
+ ret = WIMLIB_ERR_INVALID_CAPTURE_CONFIG;
+ break;
+ case WIMLIB_ERR_OPEN:
+ case WIMLIB_ERR_STAT:
+ case WIMLIB_ERR_NOMEM:
+ case WIMLIB_ERR_READ:
+ ret = WIMLIB_ERR_UNABLE_TO_READ_CAPTURE_CONFIG;
+ break;
+ }
+ return ret;