From c871c591e36d2a4083e3dda4c70144a0321ce70f Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 2 Nov 2023 12:54:47 +0100 Subject: Extract OS component when using older ipsw archives Older ipsw archives have the root filesystem stored in compressed format rather than just "stored". The "Verifying Filesystem" step would then fail as compressed files are not seekable in ZIP files. This commit introduces a detection for this and has the filesystem extracted should it be required. If not using a cache path, the temp file used for extraction will be deleted after the procedure is completed. --- src/common.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/common.c') diff --git a/src/common.c b/src/common.c index 068f2dd..0ad775c 100644 --- a/src/common.c +++ b/src/common.c @@ -695,3 +695,20 @@ int _plist_dict_copy_item(plist_t target_dict, plist_t source_dict, const char * plist_dict_set_item(target_dict, key, plist_copy(node)); return 0; } + +char* path_get_basename(char* path) +{ +#ifdef WIN32 + char *p = path + strlen(path); + while (p > path) { + if ((*p == '/') || (*p == '\\')) { + return p+1; + } + p--; + } + return p; +#else + char *p = strrchr(path, '/'); + return p ? p + 1 : path; +#endif +} -- cgit v1.1-32-gdbae