Quick fix - create dynos/mods directories if they don't exist

This commit is contained in:
MysterD 2023-04-09 18:53:32 -07:00
parent 435f64fe24
commit 0aab42a27e

View file

@ -92,11 +92,18 @@ static bool mod_import_zip(char* path, bool* isLua, bool* isDynos) {
if (*isLua) { if (*isLua) {
snprintf(dstDirectory, SYS_MAX_PATH, "%s", (char*)fs_get_write_path(MOD_DIRECTORY)); snprintf(dstDirectory, SYS_MAX_PATH, "%s", (char*)fs_get_write_path(MOD_DIRECTORY));
} else if (*isDynos) { } else if (*isDynos) {
char* dynosPath = (char*)fs_get_write_path(DYNOS_RES_FOLDER);
if (!fs_sys_dir_exists(dynosPath)) {
fs_sys_mkdir(dynosPath);
}
snprintf(dstDirectory, SYS_MAX_PATH, "%s", (char*)fs_get_write_path(DYNOS_PACKS_FOLDER)); snprintf(dstDirectory, SYS_MAX_PATH, "%s", (char*)fs_get_write_path(DYNOS_PACKS_FOLDER));
} else { } else {
LOG_ERROR("Could not figure out what type of mod this is"); LOG_ERROR("Could not figure out what type of mod this is");
return false; return false;
} }
if (!fs_sys_dir_exists(dstDirectory)) {
fs_sys_mkdir(dstDirectory);
}
// Extract the archive // Extract the archive
for (int i = 0; i < (int)mz_zip_reader_get_num_files(&zip_archive); i++) { for (int i = 0; i < (int)mz_zip_reader_get_num_files(&zip_archive); i++) {