summaryrefslogtreecommitdiffstats
path: root/src/common.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2023-11-02 12:54:47 +0100
committerGravatar Nikias Bassen2023-11-02 12:54:47 +0100
commitc871c591e36d2a4083e3dda4c70144a0321ce70f (patch)
treece6a990c037c78a84a5d2f99038a7e98e1425bf6 /src/common.c
parent4072cd965eab44993700b980d8848b46ec3be72e (diff)
downloadidevicerestore-c871c591e36d2a4083e3dda4c70144a0321ce70f.tar.gz
idevicerestore-c871c591e36d2a4083e3dda4c70144a0321ce70f.tar.bz2
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.
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c17
1 files changed, 17 insertions, 0 deletions
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
+}