GetRedirContents -> GetFileContents
This commit is contained in:
@@ -238,7 +238,8 @@ try_again:
|
|||||||
|
|
||||||
while( GetExtension(sPath) == "redir" )
|
while( GetExtension(sPath) == "redir" )
|
||||||
{
|
{
|
||||||
CString sNewFileName = GetRedirContents(sPath);
|
CString sNewFileName;
|
||||||
|
GetFileContents( sPath, sNewFileName );
|
||||||
CString sRealPath;
|
CString sRealPath;
|
||||||
|
|
||||||
FOREACHD_CONST( CString, data.vsDirSearchOrder, iter )
|
FOREACHD_CONST( CString, data.vsDirSearchOrder, iter )
|
||||||
|
|||||||
+17
-12
@@ -663,7 +663,8 @@ CString DerefRedir(const CString &_path)
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
CString sNewFileName = GetRedirContents( path );
|
CString sNewFileName;
|
||||||
|
GetFileContents( path, sNewFileName );
|
||||||
|
|
||||||
/* Empty is invalid. */
|
/* Empty is invalid. */
|
||||||
if( sNewFileName == "" )
|
if( sNewFileName == "" )
|
||||||
@@ -691,25 +692,29 @@ CString DerefRedir(const CString &_path)
|
|||||||
RageException::Throw( "Circular redirect '%s'", path.c_str() );
|
RageException::Throw( "Circular redirect '%s'", path.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: This can be used to read one line from any file; rename it. */
|
bool GetFileContents( const CString &sPath, CString &sOut )
|
||||||
CString GetRedirContents(const CString &path)
|
|
||||||
{
|
{
|
||||||
|
/* Don't warn if the file doesn't exist, but do warn if it exists and fails to open. */
|
||||||
|
if( !IsAFile(sPath) )
|
||||||
|
return false;
|
||||||
|
|
||||||
RageFile file;
|
RageFile file;
|
||||||
if( !file.Open(path) )
|
if( !file.Open(sPath) )
|
||||||
{
|
{
|
||||||
LOG->Warn( "GetRedirContents(%s): %s", path.c_str(), file.GetError().c_str() );
|
LOG->Warn( "GetFileContents(%s): %s", sPath.c_str(), file.GetError().c_str() );
|
||||||
return "";
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CString sNewFileName;
|
CString sData;
|
||||||
if( file.GetLine( sNewFileName ) == -1 )
|
if( file.GetLine(sData) == -1 )
|
||||||
{
|
{
|
||||||
LOG->Warn( "GetRedirContents(%s): %s", path.c_str(), file.GetError().c_str() );
|
LOG->Warn( "GetFileContents(%s): %s", sPath.c_str(), file.GetError().c_str() );
|
||||||
return "";
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
StripCrnl(sNewFileName);
|
StripCrnl( sData );
|
||||||
return sNewFileName;
|
sOut = sData;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
|||||||
@@ -308,8 +308,8 @@ void TrimLeft(CString &str, const char *s = "\r\n\t ");
|
|||||||
void TrimRight(CString &str, const char *s = "\r\n\t ");
|
void TrimRight(CString &str, const char *s = "\r\n\t ");
|
||||||
void StripCrnl(CString &s);
|
void StripCrnl(CString &s);
|
||||||
|
|
||||||
CString DerefRedir(const CString &path);
|
CString DerefRedir( const CString &sPath );
|
||||||
CString GetRedirContents(const CString &path);
|
bool GetFileContents( const CString &sPath, CString &sOut );
|
||||||
|
|
||||||
class Regex {
|
class Regex {
|
||||||
void *reg;
|
void *reg;
|
||||||
|
|||||||
@@ -467,7 +467,8 @@ try_element_again:
|
|||||||
}
|
}
|
||||||
else // bIsARedirect
|
else // bIsARedirect
|
||||||
{
|
{
|
||||||
CString sNewFileName = GetRedirContents(sPath);
|
CString sNewFileName;
|
||||||
|
GetFileContents( sPath, sNewFileName );
|
||||||
|
|
||||||
CString sNewClassName, sNewFile;
|
CString sNewClassName, sNewFile;
|
||||||
FileNameToClassAndElement(sNewFileName, sNewClassName, sNewFile);
|
FileNameToClassAndElement(sNewFileName, sNewClassName, sNewFile);
|
||||||
|
|||||||
@@ -169,8 +169,9 @@ void Alsa9Buf::GetSoundCardDebugInfo()
|
|||||||
|
|
||||||
if( DoesFileExist("/proc/asound/version") )
|
if( DoesFileExist("/proc/asound/version") )
|
||||||
{
|
{
|
||||||
const CString ver = GetRedirContents("/proc/asound/version");
|
CString sVersion;
|
||||||
LOG->Info( "ALSA: %s", ver.c_str() );
|
GetFileContents( "/proc/asound/version", sVersion );
|
||||||
|
LOG->Info( "ALSA: %s", sVersion.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
InitializeErrorHandler();
|
InitializeErrorHandler();
|
||||||
|
|||||||
Reference in New Issue
Block a user