mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
Log some warnings in the decompression code
This commit is contained in:
parent
6dfa580dfa
commit
aad63e776b
2 changed files with 22 additions and 14 deletions
|
@ -354,8 +354,6 @@ static void cb_decompressed(void *task_data, void *user_data, const char *err)
|
|||
if (path_file_exists(dec->source_file))
|
||||
remove(dec->source_file);
|
||||
|
||||
|
||||
|
||||
free(dec->source_file);
|
||||
free(dec);
|
||||
}
|
||||
|
@ -367,7 +365,6 @@ void cb_generic_download(void *task_data, void *user_data, const char *err)
|
|||
(void *data, size_t len, const char *dir_path)
|
||||
#endif
|
||||
{
|
||||
char msg[PATH_MAX_LENGTH];
|
||||
char output_path[PATH_MAX_LENGTH];
|
||||
char shaderdir[PATH_MAX_LENGTH];
|
||||
const char *file_ext = NULL;
|
||||
|
@ -432,13 +429,13 @@ void cb_generic_download(void *task_data, void *user_data, const char *err)
|
|||
transf->path, sizeof(output_path));
|
||||
|
||||
if (!retro_write_file(output_path, data->data, data->len))
|
||||
{
|
||||
err = "Write failed.";
|
||||
goto finish;
|
||||
}
|
||||
|
||||
snprintf(msg, sizeof(msg), "%s: %s.",
|
||||
msg_hash_to_str(MSG_DOWNLOAD_COMPLETE),
|
||||
transf->path);
|
||||
|
||||
rarch_main_msg_queue_push(msg, 1, 90, true);
|
||||
rarch_main_msg_queue_pushf(1, 90, true, "%s: %s",
|
||||
msg_hash_to_str(MSG_DOWNLOAD_COMPLETE), transf->path);
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
file_ext = path_get_extension(output_path);
|
||||
|
@ -448,13 +445,15 @@ void cb_generic_download(void *task_data, void *user_data, const char *err)
|
|||
|
||||
if (!strcasecmp(file_ext, "zip"))
|
||||
{
|
||||
snprintf(msg, sizeof(msg), "Decompressing %s...",
|
||||
path_basename(output_path));
|
||||
rarch_main_msg_queue_pushf(1, 90, true,
|
||||
"Decompressing %s...", path_basename(output_path));
|
||||
|
||||
rarch_main_msg_queue_push(msg, 1, 90, true);
|
||||
|
||||
rarch_task_push_decompress(output_path, dir_path, NULL,
|
||||
cb_decompressed, (void*)(uintptr_t)CB_CORE_UPDATER_DOWNLOAD);
|
||||
if (!rarch_task_push_decompress(output_path, dir_path, NULL,
|
||||
cb_decompressed, (void*)(uintptr_t)CB_CORE_UPDATER_DOWNLOAD))
|
||||
{
|
||||
rarch_main_msg_queue_pushf(1, 90, true,
|
||||
"Decompression of %s failed.", path_basename(output_path));
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (transf->type_hash == CB_CORE_UPDATER_DOWNLOAD)
|
||||
|
@ -464,6 +463,8 @@ void cb_generic_download(void *task_data, void *user_data, const char *err)
|
|||
finish:
|
||||
if (err)
|
||||
{
|
||||
rarch_main_msg_queue_pushf(1, 90, true, "Download failed.");
|
||||
|
||||
RARCH_ERR("Download of '%s' failed: %s\n",
|
||||
(transf ? transf->path: "unknown"), err);
|
||||
}
|
||||
|
|
|
@ -127,11 +127,18 @@ bool rarch_task_push_decompress(const char *source_file, const char *target_dir,
|
|||
rarch_task_t *t;
|
||||
|
||||
if (!target_dir || !target_dir[0] || !source_file || !source_file[0])
|
||||
{
|
||||
RARCH_WARN("[decompress] Empty or null source file or target directory arguments.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* zip only */
|
||||
if (!path_file_exists(source_file) || strcmp("zip", path_get_extension(source_file)) != 0)
|
||||
{
|
||||
RARCH_WARN("[decompress] File '%s' does not exist or is not a compressed file.\n",
|
||||
source_file);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!valid_ext || !valid_ext[0])
|
||||
valid_ext = NULL;
|
||||
|
|
Loading…
Add table
Reference in a new issue