From f9ca81a4768e06e2a01b555640173b5ec09fc4c8 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 9 Feb 2024 16:14:27 +0100 Subject: Fixup extaction paths for rdsquashfs on Windows - If we generate a manifest file, use the fix-path function to produce a fixed up, actual name as the source path. - When unpacking, create files for the fixed up, actual name. There is no need to touch gensquashfs, if the manifest file is used to re-pack the stuff, the original paths are used and the files are source from the fixed-up paths. Signed-off-by: David Oberhollenzer --- bin/rdsquashfs/describe.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'bin/rdsquashfs/describe.c') diff --git a/bin/rdsquashfs/describe.c b/bin/rdsquashfs/describe.c index 8c0fb16..0ac5cb6 100644 --- a/bin/rdsquashfs/describe.c +++ b/bin/rdsquashfs/describe.c @@ -6,7 +6,7 @@ */ #include "rdsquashfs.h" -static int print_name(const sqfs_tree_node_t *n, bool dont_escape) +static int print_name(const sqfs_tree_node_t *n, bool source_path) { char *start, *ptr, *name; int ret; @@ -23,7 +23,23 @@ static int print_name(const sqfs_tree_node_t *n, bool dont_escape) return -1; } - if (dont_escape || (strchr(name, ' ') == NULL && +#if defined(_WIN32) || defined(__WINDOWS__) + if (source_path) { + char *fixed = fix_win32_filename(name); + sqfs_free(name); + + if (fixed == NULL) { + fputs(stderr, "out of memor!\n"); + return -1; + } + + fputs(fixed, stdout); + free(fixed); + return 0; + } +#endif + + if (source_path || (strchr(name, ' ') == NULL && strchr(name, '"') == NULL)) { fputs(name, stdout); } else { -- cgit v1.2.3