Normalize paths in mod_file_exists()

This commit is contained in:
rPhase 2025-11-29 01:45:27 -08:00
parent 4ce9be4935
commit 0ec4de6aff

View file

@ -570,6 +570,7 @@ bool mod_file_exists(const char* filename) {
if (gLuaActiveMod == NULL) { return false; }
char normPath[SYS_MAX_PATH] = { 0 };
char normalized_relative[SYS_MAX_PATH] = "";
if (snprintf(normPath, sizeof(normPath), "%s", filename) < 0) {
LOG_ERROR("Failed to copy filename for normalization: %s", filename);
@ -579,7 +580,9 @@ bool mod_file_exists(const char* filename) {
for (s32 i = 0; i < gLuaActiveMod->fileCount; i++) {
struct ModFile* file = &gLuaActiveMod->files[i];
if (!strcmp(file->relativePath, normPath)) {
strcpy(normalized_relative, file->relativePath);
normalize_path(normalized_relative);
if (!strcmp(normalized_relative, normPath)) {
return true;
}
}