More detailed error information in wimlib_extract_pathlist()
Posted: Wed Jan 31, 2018 3:26 pm
Hello synchronicity, first I want to show my thanks for writing this great library!
I perfer wimlib in many aspect compared to wimgapi, and want to use it in Windows PE related program.
So I am writing ManagedWimLib, a C# wrapper library of wimlib.
I want to provide much error information as possible to user, for ease of debugging. But I am unable to get detailed information in extract feature, especially with wildcard (glob).
If I provide invalid wlidcard to wimlib_extract_paths or wimlib_extract_pathlist and wimlib is unable to find match, wimlib reports back WIMLIB_ERR_PATH_DOES_NOT_EXIST. But program cannot get information which wildcard caused this error, because wimlib directly writes that information into stderr.
String "No matches for path pattern" comes from append_matched_dentries(), which is not exposed to public.
Are there any other way to get this information, without piping stderr?
If not, can wimlib be patched to provide this information via progress callback?
I perfer wimlib in many aspect compared to wimgapi, and want to use it in Windows PE related program.
So I am writing ManagedWimLib, a C# wrapper library of wimlib.
I want to provide much error information as possible to user, for ease of debugging. But I am unable to get detailed information in extract feature, especially with wildcard (glob).
If I provide invalid wlidcard to wimlib_extract_paths or wimlib_extract_pathlist and wimlib is unable to find match, wimlib reports back WIMLIB_ERR_PATH_DOES_NOT_EXIST. But program cannot get information which wildcard caused this error, because wimlib directly writes that information into stderr.
Code: Select all
> E:\E\Wim>wimlib-imagex.exe extract LZX.wim 1 @ListFile.txt
[ERROR] No matches for path pattern "adsfasdf"
Note: You can use the '--nullglob' option to ignore missing files.
Note: You can use `wimlib-imagex.exe dir' to see what files and directories
are in the WIM image.
ERROR: Exiting with error code 49:
The path does not exist in the WIM image.E:\E\Wim>wimlib-imagex.exe extract LZX.wim 1 @ListFile.txt
Code: Select all
/* Append dentries matched by a path which can contain wildcard characters. */
static int
append_matched_dentries(WIMStruct *wim, const tchar *orig_pattern,
int extract_flags, struct append_dentry_ctx *ctx)
{
const size_t count_before = ctx->num_dentries;
tchar *pattern;
int ret;
pattern = canonicalize_wim_path(orig_pattern);
if (!pattern)
return WIMLIB_ERR_NOMEM;
ret = expand_path_pattern(wim_get_current_root_dentry(wim), pattern,
append_dentry_cb, ctx);
FREE(pattern);
if (ret || ctx->num_dentries > count_before)
return ret;
if (extract_flags & WIMLIB_EXTRACT_FLAG_STRICT_GLOB) {
ERROR("No matches for path pattern \"%"TS"\"", orig_pattern);
return WIMLIB_ERR_PATH_DOES_NOT_EXIST;
}
WARNING("No matches for path pattern \"%"TS"\"", orig_pattern);
return 0;
}
If not, can wimlib be patched to provide this information via progress callback?