use GetExtension, Dirname, Basename
This commit is contained in:
@@ -145,8 +145,7 @@ BGAnimation *Background::CreateSongBGA(const Song *pSong, CString sBGName) const
|
|||||||
if( !asFiles.empty() )
|
if( !asFiles.empty() )
|
||||||
{
|
{
|
||||||
pTempBGA = new BGAnimation;
|
pTempBGA = new BGAnimation;
|
||||||
CString sThrowAway, sExt;
|
const CString sExt = GetExtension( asFiles[0]) ;
|
||||||
splitrelpath( asFiles[0], sThrowAway, sThrowAway, sExt );
|
|
||||||
if( sExt.CompareNoCase("avi")==0 ||
|
if( sExt.CompareNoCase("avi")==0 ||
|
||||||
sExt.CompareNoCase("mpg")==0 ||
|
sExt.CompareNoCase("mpg")==0 ||
|
||||||
sExt.CompareNoCase("mpeg")==0 )
|
sExt.CompareNoCase("mpeg")==0 )
|
||||||
|
|||||||
@@ -121,11 +121,8 @@ bool Profile::LoadFromIni( CString sIniPath )
|
|||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
CString sDir, sFName, sExt;
|
|
||||||
splitrelpath( sIniPath, sDir, sFName, sExt );
|
|
||||||
|
|
||||||
CStringArray asBits;
|
CStringArray asBits;
|
||||||
split( sDir, SLASH, asBits, true );
|
split( Dirname(sIniPath), SLASH, asBits, true );
|
||||||
CString sLastDir = asBits.back(); // this is a number name, e.g. "0000001"
|
CString sLastDir = asBits.back(); // this is a number name, e.g. "0000001"
|
||||||
|
|
||||||
// Fill in a default value in case ini doesn't have it.
|
// Fill in a default value in case ini doesn't have it.
|
||||||
|
|||||||
@@ -508,23 +508,14 @@ void StripCrnl(CString &s)
|
|||||||
/* path is a .redir pathname. Read it and return the real one. */
|
/* path is a .redir pathname. Read it and return the real one. */
|
||||||
CString DerefRedir(const CString &path)
|
CString DerefRedir(const CString &path)
|
||||||
{
|
{
|
||||||
CString sDir, sFName, sExt;
|
if( GetExtension(path) != "redir" )
|
||||||
splitrelpath( path, sDir, sFName, sExt );
|
|
||||||
|
|
||||||
if(sExt != "redir")
|
|
||||||
{
|
{
|
||||||
CString path2 = path;
|
CString path2 = path;
|
||||||
ResolvePath( path2 );
|
ResolvePath( path2 );
|
||||||
return path2;
|
return path2;
|
||||||
}
|
}
|
||||||
|
|
||||||
CString sNewFileName;
|
CString sNewFileName = GetRedirContents( path );
|
||||||
{
|
|
||||||
ifstream file(path);
|
|
||||||
getline(file, sNewFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
StripCrnl(sNewFileName);
|
|
||||||
|
|
||||||
/* Empty is invalid. */
|
/* Empty is invalid. */
|
||||||
if(sNewFileName == "")
|
if(sNewFileName == "")
|
||||||
@@ -532,7 +523,7 @@ CString DerefRedir(const CString &path)
|
|||||||
|
|
||||||
FixSlashesInPlace( sNewFileName );
|
FixSlashesInPlace( sNewFileName );
|
||||||
|
|
||||||
CString path2 = sDir+sNewFileName;
|
CString path2 = Dirname(path) + sNewFileName;
|
||||||
|
|
||||||
CollapsePath( path2 );
|
CollapsePath( path2 );
|
||||||
|
|
||||||
@@ -546,11 +537,6 @@ CString DerefRedir(const CString &path)
|
|||||||
|
|
||||||
CString GetRedirContents(const CString &path)
|
CString GetRedirContents(const CString &path)
|
||||||
{
|
{
|
||||||
CString sDir, sFName, sExt;
|
|
||||||
splitrelpath( path, sDir, sFName, sExt );
|
|
||||||
|
|
||||||
ASSERT( sExt == "redir"); // don't ever call this on a non-redirect
|
|
||||||
|
|
||||||
CString sNewFileName;
|
CString sNewFileName;
|
||||||
{
|
{
|
||||||
ifstream file(path);
|
ifstream file(path);
|
||||||
|
|||||||
@@ -84,12 +84,6 @@ bool Sprite::LoadFromSpriteFile( RageTextureID ID )
|
|||||||
|
|
||||||
m_sSpritePath = ID.filename;
|
m_sSpritePath = ID.filename;
|
||||||
|
|
||||||
|
|
||||||
// Split for the directory. We'll need it below
|
|
||||||
CString sFontDir, sFontFileName, sFontExtension;
|
|
||||||
splitrelpath( m_sSpritePath, sFontDir, sFontFileName, sFontExtension );
|
|
||||||
|
|
||||||
|
|
||||||
// read sprite file
|
// read sprite file
|
||||||
IniFile ini;
|
IniFile ini;
|
||||||
ini.SetPath( m_sSpritePath );
|
ini.SetPath( m_sSpritePath );
|
||||||
@@ -101,7 +95,8 @@ bool Sprite::LoadFromSpriteFile( RageTextureID ID )
|
|||||||
if( sTextureFile == "" )
|
if( sTextureFile == "" )
|
||||||
RageException::Throw( "Error reading value 'Texture' from %s.", m_sSpritePath.c_str() );
|
RageException::Throw( "Error reading value 'Texture' from %s.", m_sSpritePath.c_str() );
|
||||||
|
|
||||||
ID.filename = sFontDir + sTextureFile; // save the path of the real texture
|
// save the path of the real texture
|
||||||
|
ID.filename = Dirname(m_sSpritePath) + sTextureFile;
|
||||||
{
|
{
|
||||||
vector<CString> asElementPaths;
|
vector<CString> asElementPaths;
|
||||||
GetDirListing( ID.filename + "*", asElementPaths, false, true );
|
GetDirListing( ID.filename + "*", asElementPaths, false, true );
|
||||||
|
|||||||
Reference in New Issue
Block a user