mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-26 03:51:46 +00:00
Allowed manually appending .lua to the end of a file name to avoid confusion with extensionless files
This commit is contained in:
parent
093d179408
commit
bb4f3fc581
1 changed files with 12 additions and 2 deletions
|
|
@ -120,8 +120,13 @@ static struct ModFile* smlua_find_mod_file(const char* moduleName) {
|
|||
|
||||
char luaName[SYS_MAX_PATH] = "";
|
||||
char luacName[SYS_MAX_PATH] = "";
|
||||
snprintf(luaName, SYS_MAX_PATH, "%s.lua", absolutePath);
|
||||
snprintf(luacName, SYS_MAX_PATH, "%s.luac", absolutePath);
|
||||
if (!path_ends_with(absolutePath, ".lua") && !path_ends_with(absolutePath, ".luac")) {
|
||||
snprintf(luaName, SYS_MAX_PATH, "%s.lua", absolutePath);
|
||||
snprintf(luacName, SYS_MAX_PATH, "%s.luac", absolutePath);
|
||||
} else {
|
||||
snprintf(luaName, SYS_MAX_PATH, "%s", absolutePath);
|
||||
snprintf(luacName, SYS_MAX_PATH, "%s", absolutePath);
|
||||
}
|
||||
|
||||
// since mods' relativePaths are relative to the mod's root, we can do a direct comparison
|
||||
for (int i = 0; i < gLuaActiveMod->fileCount; i++) {
|
||||
|
|
@ -201,6 +206,11 @@ static struct ModFile* smlua_find_file(const char* fileName) {
|
|||
for (int i = 0; i < gLuaActiveMod->fileCount; i++) {
|
||||
struct ModFile* file = &gLuaActiveMod->files[i];
|
||||
|
||||
// exclude lua files
|
||||
if (path_ends_with(file->relativePath, ".lua") || path_ends_with(file->relativePath, ".luac")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// check for match, normalizing to system separators
|
||||
strcpy(normalizedRelative, file->relativePath);
|
||||
normalize_path(normalizedRelative);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue