diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2024-02-09 16:14:27 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2024-02-09 16:17:23 +0100 |
commit | f9ca81a4768e06e2a01b555640173b5ec09fc4c8 (patch) | |
tree | 8688aefe824788ef4859d1c73ee915a3603d176b /bin/rdsquashfs/describe.c | |
parent | ae048f7ac4a9ab6576ca6842aa13e5c9c31e35a7 (diff) |
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'bin/rdsquashfs/describe.c')
-rw-r--r-- | bin/rdsquashfs/describe.c | 20 |
1 files changed, 18 insertions, 2 deletions
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 { |