perf: skip redundant mkdir_p in funpack for entries without subdirectories

This commit is contained in:
2026-09-15 12:56:27 +02:00
parent d9997184fd
commit a327a7f85c
+5 -4
View File
@@ -126,19 +126,20 @@ static int extract_entry(const char *out_dir, const fpk_entry_t *entry,
const void *data, size_t size)
{
char *full_path = join_path(out_dir, entry->path);
char *dir_part = dup_str(full_path);
char *slash = strrchr(dir_part, '/');
FILE *fp;
if (slash) {
if (strchr(entry->path, '/') != NULL) {
char *dir_part = dup_str(full_path);
char *slash = strrchr(dir_part, '/');
*slash = '\0';
if (!mkdir_p(dir_part)) {
free(dir_part);
free(full_path);
return 0;
}
free(dir_part);
}
free(dir_part);
fp = fopen(full_path, "wb");
if (!fp) {