fix translit load

This commit is contained in:
Glenn Maynard
2003-12-13 11:45:26 +00:00
parent 2524e91d6f
commit e6daa6d214
+13 -7
View File
@@ -101,22 +101,28 @@ TitleSubst::TitleSubst(const CString &section)
void TitleSubst::Load(const CString &filename, const CString &section) void TitleSubst::Load(const CString &filename, const CString &section)
{ {
RageFile f(filename); RageFile f;
if( !f.Open(filename) )
if (!f.IsOpen() || f.GetError() != 0) {
LOG->Trace("Error opening %s: %s", filename.c_str(), f.GetError().c_str() );
return; return;
}
CString CurrentSection; CString CurrentSection;
TitleTrans tr; TitleTrans tr;
while (!f.AtEOF()) while (!f.AtEOF())
{ {
CString line = f.GetLine(); CString line;
if (f.GetError() != 0) int ret = f.GetLine( line );
if( ret == 0 )
break;
if( ret == -1 )
{ {
f.ClearError(); LOG->Trace("Error reading %s: %s", filename.c_str(), f.GetError().c_str() );
continue; break;
} }
if(line.size() > 0 && utf8_get_char(line.c_str()) == 0xFEFF) if(line.size() > 0 && utf8_get_char(line.c_str()) == 0xFEFF)
{ {
/* Annoying header that Windows puts on UTF-8 plaintext /* Annoying header that Windows puts on UTF-8 plaintext