Changed command line lua script fullpath resolution logic to use cross platform QFileInfo instead of unix realpath.
This commit is contained in:
parent
d656e309a6
commit
4cea83fd1b
|
@ -25,6 +25,7 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <unzip.h>
|
#include <unzip.h>
|
||||||
|
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
#include "Qt/main.h"
|
#include "Qt/main.h"
|
||||||
#include "Qt/throttle.h"
|
#include "Qt/throttle.h"
|
||||||
|
@ -961,18 +962,27 @@ int fceuWrapperInit( int argc, char *argv[] )
|
||||||
// load lua script if option passed
|
// load lua script if option passed
|
||||||
g_config->getOption("SDL.LuaScript", &s);
|
g_config->getOption("SDL.LuaScript", &s);
|
||||||
g_config->setOption("SDL.LuaScript", "");
|
g_config->setOption("SDL.LuaScript", "");
|
||||||
if (s != "")
|
if (s.size() > 0)
|
||||||
{
|
{
|
||||||
#if defined(__linux__) || defined(__APPLE__) || defined(__unix__)
|
QFileInfo fi( s.c_str() );
|
||||||
|
|
||||||
// Resolve absolute path to file
|
// Resolve absolute path to file
|
||||||
char fullpath[2048];
|
if ( fi.exists() )
|
||||||
if ( realpath( s.c_str(), fullpath ) != NULL )
|
|
||||||
{
|
{
|
||||||
//printf("Fullpath: '%s'\n", fullpath );
|
//printf("FI: '%s'\n", fi.absoluteFilePath().toStdString().c_str() );
|
||||||
s.assign( fullpath );
|
//printf("FI: '%s'\n", fi.canonicalFilePath().toStdString().c_str() );
|
||||||
|
s = fi.canonicalFilePath().toStdString();
|
||||||
}
|
}
|
||||||
#endif
|
//#if defined(__linux__) || defined(__APPLE__) || defined(__unix__)
|
||||||
|
//
|
||||||
|
// // 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());
|
FCEU_LoadLuaCode(s.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue