mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-12-05 07:32:52 +00:00
Normalize paths in smlua_find_mod_file() (#1042)
* Normalize paths in smlua_find_mod_file() Without normalizing the relative path, the comparison fails when a mod using require is hosted/joined cross-platform. Without this fix, any mod using require is effectively not cross platform. This is critical. * Address peachy's comment --------- Co-authored-by: MysterD <myster@d>
This commit is contained in:
parent
a1b178fb64
commit
796111cc6e
1 changed files with 5 additions and 2 deletions
|
|
@ -68,6 +68,7 @@ void smlua_cache_module_result(lua_State* L, struct Mod* mod, struct ModFile* fi
|
||||||
static struct ModFile* smlua_find_mod_file(const char* moduleName) {
|
static struct ModFile* smlua_find_mod_file(const char* moduleName) {
|
||||||
char basePath[SYS_MAX_PATH] = "";
|
char basePath[SYS_MAX_PATH] = "";
|
||||||
char absolutePath[SYS_MAX_PATH] = "";
|
char absolutePath[SYS_MAX_PATH] = "";
|
||||||
|
char normalizedRelative[SYS_MAX_PATH] = "";
|
||||||
|
|
||||||
if (!gLuaActiveMod) {
|
if (!gLuaActiveMod) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -100,8 +101,10 @@ static struct ModFile* smlua_find_mod_file(const char* moduleName) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for match
|
// check for match, normalizing to system separators
|
||||||
if (!strcmp(file->relativePath, luaName) || !strcmp(file->relativePath, luacName)) {
|
strcpy(normalizedRelative, file->relativePath);
|
||||||
|
normalize_path(normalizedRelative);
|
||||||
|
if (!strcmp(normalizedRelative, luaName) || !strcmp(normalizedRelative, luacName)) {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue