Commit 59200e33 authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Some archives don't have DIZ in the root directory

(I'm looking at you, mist1221.zip)

... so first try to extract DIZ files from the root of the archive, then try again searching nested directories too. <sigh>
parent f609ac6c
Pipeline #2957 passed with stage
in 15 minutes and 43 seconds
......@@ -1027,20 +1027,23 @@ bool extract_diz(scfg_t* cfg, file_t* f, str_list_t diz_fnames, char* path, size
return false;
}
if(extract_files_from_archive(archive
,/* outdir: */cfg->temp_dir
,/* allowed_filename_chars: */NULL /* any */
,/* with_path: */true
,/* overwrite: */false
,/* max_files: */strListCount(diz_fnames)
,/* file_list: */diz_fnames
,/* error: */NULL, 0) >= 0) {
for(i = 0; diz_fnames[i] != NULL; i++) {
safe_snprintf(path, maxlen, "%s%s", cfg->temp_dir, diz_fnames[i]); // no slash
if(fexistcase(path))
return true;
for(int nested = 0; nested <= 1; nested++) {
if(extract_files_from_archive(archive
,/* outdir: */cfg->temp_dir
,/* allowed_filename_chars: */NULL /* any */
,/* with_path: */!nested
,/* overwrite: */false
,/* max_files: */strListCount(diz_fnames)
,/* file_list: */diz_fnames
,/* error: */NULL, 0) >= 0) {
for(i = 0; diz_fnames[i] != NULL; i++) {
safe_snprintf(path, maxlen, "%s%s", cfg->temp_dir, diz_fnames[i]); // no slash
if(fexistcase(path))
return true;
}
if(nested)
return false;
}
return false;
}
char* fext = getfext(f->name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment