be a bit more clever trying to find a custom lua startup file
This commit is contained in:
parent
6739208bbe
commit
13db0d48c9
2 changed files with 14 additions and 0 deletions
|
@ -615,6 +615,16 @@ static void LibraryFileName(const char *file, char(&buffer)[PATH_MAX])
|
|||
return;
|
||||
}
|
||||
|
||||
// Support for scripts in default scripts dir.
|
||||
sprintf(buffer, "scripts/%s", file);
|
||||
if (FindFileWithExtension(buffer)) {
|
||||
return;
|
||||
}
|
||||
sprintf(buffer, "%s/scripts/%s", StratagusLibPath.c_str(), file);
|
||||
if (FindFileWithExtension(buffer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
DebugPrint("File `%s' not found\n" _C_ file);
|
||||
strcpy_s(buffer, PATH_MAX, file);
|
||||
}
|
||||
|
|
|
@ -540,6 +540,10 @@ void ParseCommandLine(int argc, char **argv, Parameters ¶meters)
|
|||
continue;
|
||||
case 'c':
|
||||
parameters.luaStartFilename = optarg;
|
||||
if (strlen(optarg) > 4 &&
|
||||
!(strstr(optarg, ".lua") == optarg + strlen(optarg) - 4)) {
|
||||
parameters.luaStartFilename += ".lua";
|
||||
}
|
||||
continue;
|
||||
case 'd': {
|
||||
StratagusLibPath = optarg;
|
||||
|
|
Loading…
Reference in a new issue