diff --git a/src/pc/mods/mod_cache.c b/src/pc/mods/mod_cache.c index 399097d63..a49f4dccd 100644 --- a/src/pc/mods/mod_cache.c +++ b/src/pc/mods/mod_cache.c @@ -1,4 +1,5 @@ #include +#include #include "mod_cache.h" #include "mods.h" #include "mod.h" @@ -7,7 +8,7 @@ #include "pc/utils/md5.h" #define MOD_CACHE_FILENAME "mod.cache" -#define MOD_CACHE_VERSION 3 +#define MOD_CACHE_VERSION 4 #define MD5_BUFFER_SIZE 1024 struct ModCacheEntry* sModCacheHead = NULL; @@ -136,10 +137,20 @@ void mod_cache_add(struct Mod* mod, struct ModFile* file) { if (!concat_path(modFilePath, mod->basePath, file->relativePath)) { return; } - normalize_path(modFilePath); + + if (modFilePath[0] == '.' && (modFilePath[1] == '/' || modFilePath[1] == '\\')) { + char modAbsFilePath[SYS_MAX_PATH] = { 0 }; + getcwd(modAbsFilePath, SYS_MAX_PATH-1); + strncat(modAbsFilePath, "/", SYS_MAX_PATH-1); + strncat(modAbsFilePath, modFilePath, SYS_MAX_PATH-1); + normalize_path(modAbsFilePath); + file->cachedPath = strdup(modAbsFilePath); + } else { + normalize_path(modFilePath); + file->cachedPath = strdup(modFilePath); + } // hash and cache - file->cachedPath = strdup(modFilePath); mod_cache_md5(file->cachedPath, file->dataHash); mod_cache_add_internal(file->dataHash, 0, file->cachedPath); } diff --git a/src/pc/network/packets/packet_mod_list.c b/src/pc/network/packets/packet_mod_list.c index 639ffdc65..eb9be5369 100644 --- a/src/pc/network/packets/packet_mod_list.c +++ b/src/pc/network/packets/packet_mod_list.c @@ -269,6 +269,7 @@ void network_receive_mod_list_file(struct Packet* p) { free((char*)file->cachedPath); } file->cachedPath = strdup(cache->path); + normalize_path(file->cachedPath); } }