X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fextract.c;h=b1f62b1268ddf02434829bccd416bdd133724c35;hb=93843920ce69aaac7414ea2eaaac54b85f6f5584;hp=337707223ba0fda506aa267ca908f1e1dd8cafe0;hpb=9d73a0741204345c60ce51901f191cd62533526f;p=wimlib diff --git a/src/extract.c b/src/extract.c index 33770722..b1f62b12 100644 --- a/src/extract.c +++ b/src/extract.c @@ -494,7 +494,8 @@ extract_streams(const tchar *path, struct apply_ctx *ctx, } } else { ret = ctx->ops->extract_unnamed_stream( - file_spec, lte, ctx); + file_spec, lte, ctx, + dentry); if (ret) goto error; } @@ -2434,7 +2435,6 @@ extract_trees(WIMStruct *wim, struct wim_dentry **trees, size_t num_trees, ctx.progress.extract.target = target; } - ctx.progress.extract.extract_root_wim_source_path = T(""); ctx.target_dentry = wim_root_dentry(wim); /* Note: ctx.target_dentry represents the dentry that gets extracted to * @target. There may be none, in which case it gets set to the image @@ -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) { @@ -2924,7 +2936,7 @@ extract_single_image(WIMStruct *wim, int image, const tchar *target, int extract_flags, wimlib_progress_func_t progress_func) { - const tchar *path = T(""); + const tchar *path = WIMLIB_WIM_ROOT_PATH; extract_flags |= WIMLIB_EXTRACT_FLAG_IMAGEMODE; return do_wimlib_extract_paths(wim, image, target, &path, 1, extract_flags, progress_func);