]> wimlib.net Git - wimlib/blobdiff - src/dentry.c
Adjust full path calculations
[wimlib] / src / dentry.c
index 97ad628f8a5df7ef5f3d27eac864aa4d40f4db4c..b0ebf64dab19a10d81350c10f3f0386eb849aa2c 100644 (file)
@@ -347,6 +347,18 @@ calculate_dentry_full_path(struct wim_dentry *dentry)
        return 0;
 }
 
+static int
+do_calculate_dentry_full_path(struct wim_dentry *dentry, void *_ignore)
+{
+       return calculate_dentry_full_path(dentry);
+}
+
+int
+calculate_dentry_tree_full_paths(struct wim_dentry *root)
+{
+       return for_dentry_in_tree(root, do_calculate_dentry_full_path, NULL);
+}
+
 tchar *
 dentry_full_path(struct wim_dentry *dentry)
 {
@@ -573,12 +585,12 @@ get_parent_dentry(WIMStruct *w, const tchar *path)
 int
 print_dentry_full_path(struct wim_dentry *dentry, void *_ignore)
 {
-       tchar *full_path = dentry_full_path(dentry);
-       if (!full_path)
-               return WIMLIB_ERR_NOMEM;
-       tprintf(T("%"TS"\n"), full_path);
-       FREE(full_path);
-       dentry->_full_path = 0;
+       int ret = calculate_dentry_full_path(dentry);
+       if (ret)
+               return ret;
+       tprintf(T("%"TS"\n"), dentry->_full_path);
+       FREE(dentry->_full_path);
+       dentry->_full_path = NULL;
        dentry->full_path_nbytes = 0;
        return 0;
 }