(tasks_decompress) Attempt to fix some Android issues

This commit is contained in:
Higor Eurípedes 2015-11-28 17:13:27 -03:00
parent cd8ce72f29
commit 3bad31e513
2 changed files with 17 additions and 16 deletions

View File

@ -425,6 +425,17 @@ void cb_generic_download(void *task_data, void *user_data, const char *err)
break; break;
} }
fill_pathname_join(output_path, dir_path,
transf->path, sizeof(output_path));
/* Make sure the directory exists */
path_basedir(output_path);
if (!path_mkdir(output_path))
{
err = "Failed to create the directory.";
goto finish;
}
fill_pathname_join(output_path, dir_path, fill_pathname_join(output_path, dir_path,
transf->path, sizeof(output_path)); transf->path, sizeof(output_path));

View File

@ -68,32 +68,22 @@ error:
snprintf(dec->callback_error, PATH_MAX_LENGTH, "Failed to deflate %s.\n", path); snprintf(dec->callback_error, PATH_MAX_LENGTH, "Failed to deflate %s.\n", path);
return 0; return 0;
} }
static void rarch_task_decompress_handler(rarch_task_t *task) static void rarch_task_decompress_handler(rarch_task_t *task)
{ {
decompress_state_t *dec = (decompress_state_t*)task->state; decompress_state_t *dec = (decompress_state_t*)task->state;
decompress_task_data_t *data = NULL; decompress_task_data_t *data = NULL;
bool failed; bool returnerr;
int ret = 0;
zlib_parse_file_iterate(&dec->zlib, &failed, dec->source_file, ret = zlib_parse_file_iterate(&dec->zlib, &returnerr, dec->source_file,
dec->valid_ext, file_decompressed, dec); dec->valid_ext, file_decompressed, dec);
if (failed) if (task->cancelled || ret != 0)
{ {
task->error = dec->callback_error; task->error = dec->callback_error;
goto task_finished; zlib_parse_file_iterate_stop(&dec->zlib);
}
if (task->cancelled)
dec->zlib.type = ZLIB_TRANSFER_DEINIT;
/* run again to free resources */
if (dec->zlib.type == ZLIB_TRANSFER_DEINIT)
{
zlib_parse_file_iterate(&dec->zlib, &failed, dec->source_file,
dec->valid_ext, file_decompressed, dec);
goto task_finished; goto task_finished;
} }
@ -102,7 +92,7 @@ static void rarch_task_decompress_handler(rarch_task_t *task)
task_finished: task_finished:
task->finished = true; task->finished = true;
if (task->cancelled) if (!task->error && task->cancelled)
task->error = strdup("Task canceled"); task->error = strdup("Task canceled");
if (!task->error) if (!task->error)