experimental: allow multi-line values to get rid of many functions unnecessarily moved into other.lua

This commit is contained in:
Chris Danford
2008-03-17 08:46:16 +00:00
parent c9f9ab8c9f
commit 37d2d42d67
+21 -2
View File
@@ -1,3 +1,9 @@
/*
http://en.wikipedia.org/wiki/INI_file
- names and values are trimmed on both sides
- semicolons start a comment line
- backslash followed by a newline doesn't break the line
*/
#include "global.h" #include "global.h"
#include "IniFile.h" #include "IniFile.h"
#include "RageUtil.h" #include "RageUtil.h"
@@ -31,7 +37,11 @@ bool IniFile::ReadFile( RageFileBasic &f )
while( 1 ) while( 1 )
{ {
RString line; RString line;
switch( f.GetLine(line) ) /* Read lines until we reach a line that doesn't end in a backslash */
while( true )
{
RString s;
switch( f.GetLine(s) )
{ {
case -1: case -1:
m_sError = f.GetError(); m_sError = f.GetError();
@@ -40,7 +50,16 @@ bool IniFile::ReadFile( RageFileBasic &f )
return true; /* eof */ return true; /* eof */
} }
utf8_remove_bom( line ); utf8_remove_bom( s );
line += s;
if( line[line.size()-1] != '\\' )
break;
line.erase( line.end()-1 );
}
if( line.size() == 0 ) if( line.size() == 0 )
continue; continue;