diff --git a/stepmania/src/ActorSound.cpp b/stepmania/src/ActorSound.cpp index c9dc61f792..2f18ea2d4d 100644 --- a/stepmania/src/ActorSound.cpp +++ b/stepmania/src/ActorSound.cpp @@ -23,14 +23,10 @@ void ActorSound::LoadFromNode( const RString& sDir, const XNode* pNode ) Actor::LoadFromNode( sDir, pNode ); RString sFile; - if( pNode->GetAttrValue("File", sFile) || pNode->GetAttrValue("Path", sFile) ) /* Path deprecated */ + if( ActorUtil::GetAttrPath(pNode, "File", sFile) || ActorUtil::GetAttrPath(pNode, "Path", sFile) ) /* Path deprecated */ { - FixSlashesInPlace( sFile ); - - RString sNewPath = sFile.Left(1) == "/"? sFile : sDir+sFile; - ActorUtil::ResolvePath( sNewPath, sDir ); - - Load( sNewPath ); + ActorUtil::ResolvePath( sFile, sDir ); + Load( sFile ); } } diff --git a/stepmania/src/DifficultyIcon.cpp b/stepmania/src/DifficultyIcon.cpp index 803d83da45..36b4592a05 100644 --- a/stepmania/src/DifficultyIcon.cpp +++ b/stepmania/src/DifficultyIcon.cpp @@ -44,14 +44,10 @@ bool DifficultyIcon::Load( RString sPath ) void DifficultyIcon::LoadFromNode( const RString& sDir, const XNode* pNode ) { RString sFile; - if( !pNode->GetAttrValue( "File", sFile ) ) + if( !ActorUtil::GetAttrPath(pNode, "File", sFile) ) RageException::Throw( "MeterDisplay in \"%s\" missing \"File\" attribute.", sDir.c_str() ); - if( !sFile.empty() && sFile[0] != '/' ) - { - sFile = sDir + sFile; - ActorUtil::ResolvePath( sFile, sDir ); - } + ActorUtil::ResolvePath( sFile, sDir ); Load( sFile ); diff --git a/stepmania/src/HoldJudgment.cpp b/stepmania/src/HoldJudgment.cpp index 3df4b51519..9835311e10 100644 --- a/stepmania/src/HoldJudgment.cpp +++ b/stepmania/src/HoldJudgment.cpp @@ -28,12 +28,9 @@ void HoldJudgment::Load( const RString &sPath ) void HoldJudgment::LoadFromNode( const RString& sDir, const XNode* pNode ) { RString sFile; - if( !pNode->GetAttrValue("File", sFile) ) + if( ActorUtil::GetAttrPath(pNode, "File", sFile) ) RageException::Throw( "HoldJudgment node in \"%s\" is missing the attribute \"File\"", sDir.c_str() ); - if( sFile.Left(1) != "/" ) - sFile = sDir+sFile; - CollapsePath( sFile ); Load( sFile ); diff --git a/stepmania/src/Judgment.cpp b/stepmania/src/Judgment.cpp index 1c2c6ee7cb..31d19705fe 100644 --- a/stepmania/src/Judgment.cpp +++ b/stepmania/src/Judgment.cpp @@ -19,11 +19,8 @@ Judgment::Judgment() void Judgment::LoadFromNode( const RString& sDir, const XNode* pNode ) { RString sFile; - if( pNode->GetAttrValue("File", sFile) ) + if( ActorUtil::GetAttrPath(pNode, "File", sFile) ) { - if( sFile.Left(1) != "/" ) - sFile = sDir+sFile; - CollapsePath( sFile ); LoadNormal( sFile ); } diff --git a/stepmania/src/MeterDisplay.cpp b/stepmania/src/MeterDisplay.cpp index e66e3ed999..ecc79b3cdf 100644 --- a/stepmania/src/MeterDisplay.cpp +++ b/stepmania/src/MeterDisplay.cpp @@ -40,14 +40,10 @@ void MeterDisplay::LoadFromNode( const RString& sDir, const XNode* pNode ) { RString sStreamPath; - if( !pNode->GetAttrValue( "StreamPath", sStreamPath ) ) + if( !ActorUtil::GetAttrPath(pNode, "StreamPath", sStreamPath) ) RageException::Throw( "MeterDisplay in \"%s\" is missing the \"StreamPath\" attribute.", sDir.c_str() ); - if( !sStreamPath.empty() && sStreamPath[0] != '/' ) - { - sStreamPath = sDir + sStreamPath; - ActorUtil::ResolvePath( sStreamPath, sDir ); - } + ActorUtil::ResolvePath( sStreamPath, sDir ); m_sprStream.Load( sStreamPath ); m_sprStream->SetZoomX( m_fStreamWidth / m_sprStream->GetUnzoomedWidth() ); diff --git a/stepmania/src/Model.cpp b/stepmania/src/Model.cpp index 8ef6324c56..4d03cb6c70 100644 --- a/stepmania/src/Model.cpp +++ b/stepmania/src/Model.cpp @@ -111,20 +111,12 @@ void Model::LoadFromNode( const RString& sDir, const XNode* pNode ) Actor::LoadFromNode( sDir, pNode ); RString s1, s2, s3; - pNode->GetAttrValue( "Meshes", s1 ); - pNode->GetAttrValue( "Materials", s2 ); - pNode->GetAttrValue( "Bones", s3 ); + ActorUtil::GetAttrPath( pNode, "Meshes", s1 ); + ActorUtil::GetAttrPath( pNode, "Materials", s2 ); + ActorUtil::GetAttrPath( pNode, "Bones", s3 ); if( !s1.empty() || !s2.empty() || !s3.empty() ) { ASSERT( !s1.empty() && !s2.empty() && !s3.empty() ); - - if( s1.Left(1) != "/" ) - s1 = sDir+s1; - if( s2.Left(1) != "/" ) - s2 = sDir+s2; - if( s3.Left(1) != "/" ) - s3 = sDir+s3; - LoadPieces( s1, s2, s3 ); } } diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 2511cfe1d9..68d72a8d3c 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -109,11 +109,7 @@ void Sprite::Load( RageTextureID ID ) void Sprite::LoadFromNode( const RString& sDir, const XNode* pNode ) { RString sPath; - if( pNode->GetAttrValue( "Texture", sPath ) ) - { - bool bIsAbsolutePath = sPath.Left(1) == "/"; - sPath = bIsAbsolutePath ? sPath : sDir+sPath; - } + ActorUtil::GetAttrPath( pNode, "Texture", sPath ); if( !sPath.empty() ) {