extern bool
should_ignore_filename(const tchar *name, int name_nchars);
+extern void
+attach_scanned_tree(struct wim_dentry *parent, struct wim_dentry *child,
+ struct blob_table *blob_table);
+
#endif /* _WIMLIB_CAPTURE_H */
return false;
}
+
+/* Attach a newly scanned directory tree to its parent directory, with duplicate
+ * handling. */
+void
+attach_scanned_tree(struct wim_dentry *parent, struct wim_dentry *child,
+ struct blob_table *blob_table)
+{
+ struct wim_dentry *duplicate;
+
+ if (child && (duplicate = dentry_add_child(parent, child))) {
+ WARNING("Duplicate file path: \"%"TS"\". Only capturing "
+ "the first version.", dentry_full_path(duplicate));
+ free_dentry_tree(child, blob_table);
+ }
+}
ret = ntfs_3g_build_dentry_tree_recursive(&child, mref, ctx->path,
path_len, name_type,
ctx->volume, ctx->params);
- if (child)
- dentry_add_child(ctx->parent, child);
+ attach_scanned_tree(ctx->parent, child, ctx->params->blob_table);
out_free_mbs_name:
FREE(mbs_name);
out:
full_path[full_path_len] = '\0';
if (ret)
break;
- if (child)
- dentry_add_child(dir_dentry, child);
+ attach_scanned_tree(dir_dentry, child, params->blob_table);
}
closedir(dir);
return ret;
if (ret)
goto out_free_buf;
- if (child)
- dentry_add_child(parent, child);
+ attach_scanned_tree(parent, child, params->blob_table);
}
if (info->NextEntryOffset == 0)
break;