commit 9ac68512
Removed fstream from common
Changed files
| M | source/code/common.cpp before |
| M | source/code/common.h before |
| M | source/code/highscore.h before |
| M | source/code/stats.cpp before |
diff --git a/source/code/common.cpp b/source/code/common.cpp
index 98023cc..110aefa 100644
--- a/source/code/common.cpp
+++ b/source/code/common.cpp
@@ -27,6 +27,7 @@ http://blockattack.net
#include "os.hpp"
#include "sago/SagoMiscSdl2.hpp"
#include <stdarg.h>
+#include "Libs/physfs.hpp"
using namespace std;
using boost::format;
@@ -174,8 +175,7 @@ Config::Config() {
}
void Config::load() {
- string filename = getPathToSaveFiles()+"/configFile";
- ifstream inFile(filename.c_str());
+ PhysFS::ifstream inFile("configFile");
string key;
string previuskey;
char value[MAX_VAR_LENGTH];
@@ -193,7 +193,6 @@ void Config::load() {
#endif
configMap[key] = (string)value;
}
- inFile.close();
}
}
@@ -206,8 +205,7 @@ Config* Config::getInstance() {
}
void Config::save() {
- string filename = getPathToSaveFiles()+"/configFile";
- ofstream outFile(filename.c_str(),ios::trunc);
+ PhysFS::ofstream outFile("configFile");
if (outFile) {
map<string,string>::iterator iter;
@@ -217,7 +215,6 @@ void Config::save() {
outFile << "\n"; //The last entry in the file will be read double if a linebreak is missing
//This is checked on load too in case a user changes it himself.
}
- outFile.close();
}
bool Config::exists(const string& varName) const {
diff --git a/source/code/common.h b/source/code/common.h
index 9b49e6b..a445330 100644
--- a/source/code/common.h
+++ b/source/code/common.h
@@ -32,7 +32,6 @@ http://blockattack.net
#include <string>
#include <iostream>
-#include <fstream>
#include <map>
#include <stdlib.h>
#include <libintl.h>
diff --git a/source/code/highscore.h b/source/code/highscore.h
index 4e8d5fe..e07568e 100644
--- a/source/code/highscore.h
+++ b/source/code/highscore.h
@@ -22,7 +22,6 @@ http://blockattack.net
*/
#include <iostream>
-#include <fstream>
#include <cstring>
#include <string>
#include <stdlib.h>
diff --git a/source/code/stats.cpp b/source/code/stats.cpp
index a3070b7..2ff6cdf 100644
--- a/source/code/stats.cpp
+++ b/source/code/stats.cpp
@@ -24,6 +24,7 @@ http://blockattack.net
#include "stats.h"
#include "common.h"
#include "os.hpp"
+#include <fstream>
using namespace std;