From 8a0cd66849c9b62b5b9824e5f8b9414016243553 Mon Sep 17 00:00:00 2001 From: MysterD Date: Mon, 11 Apr 2022 23:33:21 -0700 Subject: [PATCH] change how downloaded directory mods are saved --- src/pc/network/packets/packet_mod_list.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/pc/network/packets/packet_mod_list.c b/src/pc/network/packets/packet_mod_list.c index fac5db90..18461908 100644 --- a/src/pc/network/packets/packet_mod_list.c +++ b/src/pc/network/packets/packet_mod_list.c @@ -146,9 +146,17 @@ void network_receive_mod_list(struct Packet* p) { totalSize += mod->size; LOG_INFO(" '%s': %llu", mod->name, (u64)mod->size); - if (snprintf(mod->basePath, SYS_MAX_PATH - 1, "%s", gRemoteModsBasePath) < 0) { - LOG_ERROR("Failed save remote base path!"); - return; + if (mod->isDirectory) { + if (snprintf(mod->basePath, SYS_MAX_PATH - 1, "%s/%s", gRemoteModsBasePath, mod->relativePath) < 0) { + LOG_ERROR("Failed save remote base path!"); + return; + } + normalize_path(mod->basePath); + } else { + if (snprintf(mod->basePath, SYS_MAX_PATH - 1, "%s", gRemoteModsBasePath) < 0) { + LOG_ERROR("Failed save remote base path!"); + return; + } } if (mod->size >= MAX_MOD_SIZE) { @@ -171,13 +179,6 @@ void network_receive_mod_list(struct Packet* p) { packet_read(p, file->relativePath, relativePathLength * sizeof(u8)); packet_read(p, &file->size, sizeof(u64)); file->fp = NULL; - if (mod->isDirectory && !strstr(file->relativePath, "actors") && !strstr(file->relativePath, "levels") && !strstr(file->relativePath, "sound")) { - char tmp[SYS_MAX_PATH]; - if (snprintf(tmp, SYS_MAX_PATH, "%s-%s", mod->relativePath, file->relativePath) >= 0) { - memcpy(file->relativePath, tmp, strlen(tmp) + 1); - } - } - normalize_path(file->relativePath); LOG_INFO(" '%s': %llu", file->relativePath, (u64)file->size); } }