use Dirname

This commit is contained in:
Glenn Maynard
2003-10-29 20:23:38 +00:00
parent f03a889274
commit 30686e64b3
2 changed files with 4 additions and 10 deletions
+2 -6
View File
@@ -20,17 +20,13 @@
Actor* MakeActor( CString sPath ) Actor* MakeActor( CString sPath )
{ {
CString sDir, sFName, sExt; CString sExt = GetExtension(sPath);
splitrelpath( sPath, sDir, sFName, sExt );
sExt.MakeLower(); sExt.MakeLower();
if( sExt=="actor" ) if( sExt=="actor" )
{ {
// TODO: Check for recursive loading // TODO: Check for recursive loading
CString sDir, sThrowAway;
splitrelpath( sPath, sDir, sThrowAway, sThrowAway );
IniFile ini; IniFile ini;
ini.SetPath( sPath ); ini.SetPath( sPath );
ini.ReadFile(); ini.ReadFile();
@@ -41,7 +37,7 @@ Actor* MakeActor( CString sPath )
CString sFileName; CString sFileName;
ini.GetValue( "Actor", "File", sFileName ); ini.GetValue( "Actor", "File", sFileName );
CString sNewPath = sDir+sFileName; CString sNewPath = Dirname( sPath ) + sFileName;
if( !DoesFileExist(sNewPath) ) if( !DoesFileExist(sNewPath) )
RageException::Throw( "The actor file '%s' references a file '%s' which doesn't exist.", sPath.c_str(), sNewPath.c_str() ); RageException::Throw( "The actor file '%s' references a file '%s' which doesn't exist.", sPath.c_str(), sNewPath.c_str() );
+2 -4
View File
@@ -51,9 +51,8 @@ void Model::Clear ()
bool Model::LoadMilkshapeAscii( CString sPath ) bool Model::LoadMilkshapeAscii( CString sPath )
{ {
CString sDir, sThrowAway;
FixSlashesInPlace(sPath); FixSlashesInPlace(sPath);
splitrelpath( sPath, sDir, sThrowAway, sThrowAway ); const CString sDir = Dirname( sPath );
FILE *file = fopen (sPath, "rt"); FILE *file = fopen (sPath, "rt");
if (!file) if (!file)
@@ -419,9 +418,8 @@ bool Model::LoadMilkshapeAscii( CString sPath )
bool Model::LoadMilkshapeAsciiBones( CString sAniName, CString sPath ) bool Model::LoadMilkshapeAsciiBones( CString sAniName, CString sPath )
{ {
CString sDir, sThrowAway;
FixSlashesInPlace(sPath); FixSlashesInPlace(sPath);
splitrelpath( sPath, sDir, sThrowAway, sThrowAway ); const CString sDir = Dirname( sPath );
FILE *file = fopen (sPath, "rt"); FILE *file = fopen (sPath, "rt");
if (!file) if (!file)