When a lua script is provided on the command line with the --loadlua option. Added code to always resolve any relative file path to an absolute as the lua core changes the current working directory which then invalidates the relative pathing from where the current working directory was at the time the program had initially been started.

This commit is contained in:
Matthew Budd 2020-05-14 23:47:57 -04:00
parent 7fb5ed52c4
commit bcbac77084
1 changed files with 9 additions and 0 deletions

View File

@ -915,6 +915,15 @@ int main(int argc, char *argv[])
g_config->setOption("SDL.LuaScript", "");
if (s != "")
{
#ifdef __linux
// Resolve absolute path to file
char fullpath[2048];
if ( realpath( s.c_str(), fullpath ) != NULL )
{
//printf("Fullpath: '%s'\n", fullpath );
s.assign( fullpath );
}
#endif
FCEU_LoadLuaCode(s.c_str());
}
#endif