diff --git a/stepmania/src/NoteSkinManager.cpp b/stepmania/src/NoteSkinManager.cpp index 3a26add9e8..5d1e50c651 100644 --- a/stepmania/src/NoteSkinManager.cpp +++ b/stepmania/src/NoteSkinManager.cpp @@ -239,7 +239,7 @@ try_again: while( GetExtension(sPath) == "redir" ) { CString sNewFileName; - GetFileContents( sPath, sNewFileName ); + GetFileContents( sPath, sNewFileName, true ); CString sRealPath; FOREACHD_CONST( CString, data.vsDirSearchOrder, iter ) diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index d70e506e45..1feffa518c 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -664,7 +664,7 @@ CString DerefRedir(const CString &_path) } CString sNewFileName; - GetFileContents( path, sNewFileName ); + GetFileContents( path, sNewFileName, true ); /* Empty is invalid. */ if( sNewFileName == "" ) @@ -692,7 +692,7 @@ CString DerefRedir(const CString &_path) RageException::Throw( "Circular redirect '%s'", path.c_str() ); } -bool GetFileContents( const CString &sPath, CString &sOut ) +bool GetFileContents( const CString &sPath, CString &sOut, bool bOneLine ) { /* Don't warn if the file doesn't exist, but do warn if it exists and fails to open. */ if( !IsAFile(sPath) ) @@ -706,13 +706,21 @@ bool GetFileContents( const CString &sPath, CString &sOut ) } CString sData; - if( file.GetLine(sData) == -1 ) + int iGot; + if( bOneLine ) + iGot = file.GetLine( sData ); + else + iGot = file.Read( sData, file.GetFileSize() ); + + if( iGot == -1 ) { LOG->Warn( "GetFileContents(%s): %s", sPath.c_str(), file.GetError().c_str() ); return false; } + + if( bOneLine ) + StripCrnl( sData ); - StripCrnl( sData ); sOut = sData; return true; } diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index 5fcb97c478..c80402de7a 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -309,7 +309,7 @@ void TrimRight(CString &str, const char *s = "\r\n\t "); void StripCrnl(CString &s); CString DerefRedir( const CString &sPath ); -bool GetFileContents( const CString &sPath, CString &sOut ); +bool GetFileContents( const CString &sPath, CString &sOut, bool bOneLine = false ); class Regex { void *reg; diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 17e7139a73..f68e851a6b 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -468,7 +468,7 @@ try_element_again: else // bIsARedirect { CString sNewFileName; - GetFileContents( sPath, sNewFileName ); + GetFileContents( sPath, sNewFileName, true ); CString sNewClassName, sNewFile; FileNameToClassAndElement(sNewFileName, sNewClassName, sNewFile);