diff --git a/android/phoenix/jni/apk-extract/apk-extract.c b/android/phoenix/jni/apk-extract/apk-extract.c index 7c3cc7516d..261cd92617 100644 --- a/android/phoenix/jni/apk-extract/apk-extract.c +++ b/android/phoenix/jni/apk-extract/apk-extract.c @@ -22,6 +22,8 @@ struct userdata static bool zlib_cb(const char *name, const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size, uint32_t crc32, void *userdata) { + char path[PATH_MAX]; + char path_dir[PATH_MAX]; struct userdata *user = userdata; const char *subdir = user->subdir; const char *dest = user->dest; @@ -31,8 +33,6 @@ static bool zlib_cb(const char *name, const uint8_t *cdata, unsigned cmode, uint name += strlen(subdir) + 1; - char path[PATH_MAX]; - char path_dir[PATH_MAX]; fill_pathname_join(path, dest, name, sizeof(path)); fill_pathname_basedir(path_dir, path, sizeof(path_dir)); diff --git a/apple/iOS/browser.m b/apple/iOS/browser.m index c9405943fc..4c90ec3bc6 100644 --- a/apple/iOS/browser.m +++ b/apple/iOS/browser.m @@ -30,20 +30,17 @@ static bool zlib_extract_callback(const char *name, const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size, uint32_t crc32, void *userdata) { - char path[PATH_MAX]; + char path[PATH_MAX], msg[256]; - if (cmode != 0 && cmode != 8) - { - char msg[256]; - snprintf(msg, sizeof(msg), "Could not unzip %s (unknown mode %d)", name, cmode); - apple_display_alert(msg, "Action Failed"); - return false; - } - // Make directory fill_pathname_join(path, (const char*)userdata, name, sizeof(path)); path_basedir(path); - path_mkdir(path); + + if (!path_mkdir(path_dir)) + { + RARCH_ERR("Failed to create dir: %s.\n", path_dir); + return false; + } // Ignore directories if (name[strlen(name) - 1] == '/') @@ -59,6 +56,10 @@ static bool zlib_extract_callback(const char *name, case 8: // Deflate zlib_inflate_data_to_file(path, cdata, csize, size, crc32); break; + default: + snprintf(msg, sizeof(msg), "Could not unzip %s (unknown mode %d)", name, cmode); + apple_display_alert(msg, "Action Failed"); + return false; } return true;