summaryrefslogtreecommitdiff
path: root/bin/rdsquashfs/describe.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2024-02-09 16:14:27 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2024-02-09 16:17:23 +0100
commitf9ca81a4768e06e2a01b555640173b5ec09fc4c8 (patch)
tree8688aefe824788ef4859d1c73ee915a3603d176b /bin/rdsquashfs/describe.c
parentae048f7ac4a9ab6576ca6842aa13e5c9c31e35a7 (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.c20
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 {