Changeset 170 for trunk/src/configuration.cpp
- Timestamp:
- 10/03/2008 08:17:22 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/src/configuration.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/configuration.cpp
r167 r170 19 19 ***************************************************************************/ 20 20 21 #include <iostream>22 21 #include <cstdlib> // used in the back-compatibility code 23 22 #include <sstream> … … 37 36 m_file = file; 38 37 39 cerr<<"loading file: "<<file<<endl;40 38 ifstream conf_file (file.c_str()); 41 39 if (!conf_file.is_open()) { 42 40 // file couldn't be opened, this is due to missing file or 43 41 // permission error. 44 cerr<<"Error openning configuration file for reading: "<<m_file<<endl; 42 loadDefaultSettings(); 43 save(); 44 return; 45 45 } 46 46 … … 49 49 string header; 50 50 getline(conf_file,header); 51 cerr<<"line: "<<header.substr(0,11)<<endl;52 51 if (header.substr(0,11) != "openyahtzee") { 53 52 // this is probably an old sqllite file import it. … … 59 58 while(!conf_file.eof()) { 60 59 getline(conf_file,header); 61 cerr<<"line: "<<header<<endl;62 60 if (header == "[settings]") { 63 61 parseSettings(&conf_file); … … 73 71 { 74 72 loadDefaultSettings(); 75 cerr<<"parsing settings"<<endl;76 73 string temp_line; 77 74 size_t pos; // used to loacate the '=' sign … … 91 88 return; 92 89 } 93 cerr<<"key: "<<temp_line.substr(0,pos)<<endl;94 cerr<<"value: "<<temp_line.substr(pos+1)<<endl;95 90 m_settings[temp_line.substr(0,pos)] = temp_line.substr(pos+1); 96 91 } … … 124 119 temp_item.date = date+" "+hour; 125 120 m_highscores.push_back(temp_item); 126 cerr<<score<<" "<<name<<" "<<temp_item.date<<endl;127 121 128 122 // The following two lines read one character forword and … … 139 133 ofstream conf_file (m_file.c_str()); 140 134 if (!conf_file.is_open()) { 141 // file couldn't be opened, this is due to missing file or 142 // permission error. 143 cerr<<"Error openning configuration file for writing: "<<m_file<<endl; 135 // file couldn't be opened, probably due to permission error 136 return; 144 137 } 145 138 conf_file<<"openyahtzee="<<VERSION<<endl;
Note: See TracChangeset
for help on using the changeset viewer.
