X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fwin32_capture.c;h=c62abce7c91c175a21bb8882232b0f87cde913b7;hp=745ee77a739bbb1712d3baa78ea3023513f0b02b;hb=93843920ce69aaac7414ea2eaaac54b85f6f5584;hpb=5ede6282b6f28fcd71d6eb556dae69e83d925e11 diff --git a/src/win32_capture.c b/src/win32_capture.c index 745ee77a..c62abce7 100644 --- a/src/win32_capture.c +++ b/src/win32_capture.c @@ -1411,6 +1411,16 @@ win32_build_dentry_tree(struct wim_dentry **root_ret, wmemcpy(path, root_disk_path, path_nchars + 1); } + /* Strip trailing slashes. If we don't do this, we may create a path + * with multiple consecutive backslashes, which for some reason causes + * Windows to report that the file cannot be found. */ + while (path_nchars >= 2 && + path[path_nchars - 1] == L'\\' && + path[path_nchars - 2] != L':') + { + path[--path_nchars] = L'\0'; + } + params->capture_root_nchars = path_nchars; memset(&state, 0, sizeof(state));