X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fextract.c;h=b1f62b1268ddf02434829bccd416bdd133724c35;hp=1b7eb6bcf57935c0467d47b5a560e0842c6db6d3;hb=93843920ce69aaac7414ea2eaaac54b85f6f5584;hpb=5ede6282b6f28fcd71d6eb556dae69e83d925e11 diff --git a/src/extract.c b/src/extract.c index 1b7eb6bc..b1f62b12 100644 --- a/src/extract.c +++ b/src/extract.c @@ -2529,6 +2529,18 @@ extract_trees(WIMStruct *wim, struct wim_dentry **trees, size_t num_trees, goto out_destroy_stream_list; } ctx.realtarget_nchars = tstrlen(ctx.realtarget); + #ifdef __WIN32__ + /* 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 (ctx.realtarget_nchars >= 2 + && ctx.realtarget[ctx.realtarget_nchars - 1] == L'\\' + && ctx.realtarget[ctx.realtarget_nchars - 2] != L':') + { + ctx.realtarget[--ctx.realtarget_nchars] = L'\0'; + } + #endif } if (progress_func) {