diff options
| author | Kris Parker | 2009-10-30 18:11:10 +0000 |
|---|---|---|
| committer | Kris Parker | 2009-10-30 18:11:10 +0000 |
| commit | 4fb5db10df0a99475433865b3ee2b88303a1d9c5 (patch) | |
| tree | a67a934a1236bfa0ef340083e501c6c9217bde52 /Config.cpp | |
| parent | f64930129308105f8b60a4a90c9a4a40df75ef6d (diff) | |
| download | stonesense-4fb5db10df0a99475433865b3ee2b88303a1d9c5.tar.gz stonesense-4fb5db10df0a99475433865b3ee2b88303a1d9c5.tar.bz2 stonesense-4fb5db10df0a99475433865b3ee2b88303a1d9c5.tar.xz | |
Some foolproofing for init.txt files
Diffstat (limited to 'Config.cpp')
| -rw-r--r-- | Config.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -45,6 +45,11 @@ int parseIntFromLine( string keyword, string line ){ void parseConfigLine( string line ){
char c = line[0];
if( c != '[') return;
+
+ //some systems don't remove the \r char as a part of the line change:
+ if(line.size() > 0 && line[line.size() -1 ] == '\r' )
+ line.resize(line.size() -1);
+
c = line[ line.length() -1 ];
if( c != ']' ) return;
@@ -103,7 +108,10 @@ bool loadConfigFile(){ string line;
ifstream myfile ("init.txt");
if (myfile.is_open() == false)
+ {
+ cout << "Cannot find init file" << endl;
return false;
+ }
while ( !myfile.eof() )
{
|
