error checking
This commit is contained in:
@@ -556,8 +556,19 @@ CString DerefRedir(const CString &path)
|
|||||||
/* XXX: This can be used to read one line from any file; rename it. */
|
/* XXX: This can be used to read one line from any file; rename it. */
|
||||||
CString GetRedirContents(const CString &path)
|
CString GetRedirContents(const CString &path)
|
||||||
{
|
{
|
||||||
RageFile file(path);
|
RageFile file;
|
||||||
CString sNewFileName = file.GetLine();
|
if( !file.Open(path) )
|
||||||
|
{
|
||||||
|
LOG->Warn( "GetRedirContents(%s): %s", path.c_str(), file.GetError().c_str() );
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
CString sNewFileName;
|
||||||
|
if( file.GetLine( sNewFileName ) == -1 )
|
||||||
|
{
|
||||||
|
LOG->Warn( "GetRedirContents(%s): %s", path.c_str(), file.GetError().c_str() );
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
StripCrnl(sNewFileName);
|
StripCrnl(sNewFileName);
|
||||||
return sNewFileName;
|
return sNewFileName;
|
||||||
@@ -1193,7 +1204,8 @@ bool FileRead(RageFile& f, CString& sOut)
|
|||||||
{
|
{
|
||||||
if (f.AtEOF())
|
if (f.AtEOF())
|
||||||
return false;
|
return false;
|
||||||
sOut = f.GetLine();
|
if( f.GetLine(sOut) == -1 )
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user