Resolve directory names to embedded default.xml/default.lua files

at the pathname resolution stage (THEME:GetPath, ResolvePath),
not at loading.  This means that pathnames to Lua files are actually
paths to Lua files, without any extra processing, and we always
load actual files (except for BGAnimation compatibility), not
directories.

(fixes Lua LoadActor() on a directory loading as a BGA and not
as Lua)
This commit is contained in:
Glenn Maynard
2006-11-22 01:51:31 +00:00
parent 91f2f662b1
commit d1759bb123
2 changed files with 31 additions and 20 deletions
+17 -20
View File
@@ -103,6 +103,23 @@ retry:
sPath = asPaths[0];
}
if( ft == RageFileManager::TYPE_DIR )
{
RString sXMLPath = sPath + "/default.xml";
if( DoesFileExist(sXMLPath) )
{
sPath = sXMLPath;
return true;
}
RString sLuaPath = sPath + "/default.lua";
if( DoesFileExist(sLuaPath) )
{
sPath = sLuaPath;
return true;
}
}
sPath = DerefRedir( sPath );
return true;
}
@@ -356,26 +373,6 @@ Actor* ActorUtil::MakeActor( const RString &sPath_, Actor *pParentActor, const X
if( ft == FT_Directory && sPath.Right(1) != "/" )
sPath += '/';
if( ft == FT_Directory )
{
RString sXMLPath = sPath + "default.xml";
if( DoesFileExist(sXMLPath) )
{
sPath = sXMLPath;
ft = FT_Xml;
}
}
if( ft == FT_Directory )
{
RString sLuaPath = sPath + "default.lua";
if( DoesFileExist(sLuaPath) )
{
sPath = sLuaPath;
ft = FT_Lua;
}
}
switch( ft )
{
case FT_Xml: