]> wimlib.net Git - wimlib/blobdiff - src/scan.c
mount_image.c: add fallback definitions of RENAME_* constants
[wimlib] / src / scan.c
index cc86d808a13d3ba02a66aef7ad284b945ef0722a..483428fc1db8d546df052f082b66f3a3005cf93a 100644 (file)
@@ -16,7 +16,7 @@
  * details.
  *
  * You should have received a copy of the GNU Lesser General Public License
- * along with this file; if not, see http://www.gnu.org/licenses/.
+ * along with this file; if not, see https://www.gnu.org/licenses/.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -214,9 +214,9 @@ read_capture_config(const tchar *config_file, const void *buf,
        };
        void *mem;
 
-       ret = do_load_text_file(config_file, buf, bufsize, &mem,
-                               sections, ARRAY_LEN(sections),
-                               LOAD_TEXT_FILE_REMOVE_QUOTES, mangle_pat);
+       ret = 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);
@@ -254,14 +254,15 @@ destroy_capture_config(struct capture_config *config)
 }
 
 /*
- * Determine whether @path, or any ancestor directory of @path, matches any of
- * the patterns in @list.  Path separators in @path must be WIM_PATH_SEPARATOR.
+ * Determine whether @path matches any of the patterns in @list.
+ * Path separators in @path must be WIM_PATH_SEPARATOR.
  */
 bool
-match_pattern_list(const tchar *path, const struct string_list *list)
+match_pattern_list(const tchar *path, const struct string_list *list,
+                  int match_flags)
 {
        for (size_t i = 0; i < list->num_strings; i++)
-               if (match_path(path, list->strings[i], true))
+               if (match_path(path, list->strings[i], match_flags))
                        return true;
        return false;
 }
@@ -292,8 +293,10 @@ try_exclude(const struct scan_params *params)
 
        if (params->config) {
                const tchar *path = params->cur_path + params->root_path_nchars;
-               if (match_pattern_list(path, &params->config->exclusion_pats) &&
-                   !match_pattern_list(path, &params->config->exclusion_exception_pats))
+               if (match_pattern_list(path, &params->config->exclusion_pats,
+                                      MATCH_RECURSIVELY) &&
+                   !match_pattern_list(path, &params->config->exclusion_exception_pats,
+                                       MATCH_RECURSIVELY | MATCH_ANCESTORS))
                        return -1;
        }