Lua scripting pathing improvements for Linux/MacOS. Use realpath when possible to always have a absolute path for scripts and roms internally.
This commit is contained in:
parent
0cca02e765
commit
5c29bdbd8d
|
@ -753,7 +753,8 @@ int fceuWrapperInit( int argc, char *argv[] )
|
|||
g_config->setOption("SDL.LuaScript", "");
|
||||
if (s != "")
|
||||
{
|
||||
#ifdef __linux
|
||||
#if defined(__linux) || defined(__APPLE__)
|
||||
|
||||
// Resolve absolute path to file
|
||||
char fullpath[2048];
|
||||
if ( realpath( s.c_str(), fullpath ) != NULL )
|
||||
|
|
|
@ -618,16 +618,10 @@ static int emu_loadrom(lua_State *L)
|
|||
const char *nameo2 = luaL_checkstring(L,1);
|
||||
char nameo[2048];
|
||||
|
||||
if ( nameo2[0] == '/' )
|
||||
if ( realpath( nameo2, nameo ) == NULL )
|
||||
{
|
||||
strncpy(nameo, nameo2, sizeof(nameo));
|
||||
}
|
||||
else
|
||||
{
|
||||
char cwd[1024];
|
||||
getcwd( cwd, sizeof(cwd) );
|
||||
snprintf( nameo, sizeof(nameo), "%s/%s", cwd, nameo2 );
|
||||
}
|
||||
//printf("Load ROM: '%s'\n", nameo );
|
||||
if (!LoadGame(nameo, true))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue