#include "Settings.h"
#include "Game.h"
#include "Input.h"
+#include "Utils/Folders.h"
using namespace Game;
newscreenheight = screenheight;
if (newscreenheight < 0)
newscreenheight = screenheight;
- ofstream opstream(ConvertFileName(":Data:config.txt", "w"));
+ errno = 0;
+ ofstream opstream(Folders::getConfigFilePath());
+ if (opstream.fail()) {
+ perror(("Couldn't save config file " + Folders::getConfigFilePath()).c_str());
+ return;
+ }
opstream << "Screenwidth:\n";
opstream << newscreenwidth;
opstream << "\nScreenheight:\n";
bool LoadSettings()
{
- ifstream ipstream(ConvertFileName(":Data:config.txt"), std::ios::in);
- if ( !ipstream || ipstream.fail() ) {
- printf("Config file not found\n");
+ errno = 0;
+ ifstream ipstream(Folders::getConfigFilePath(), std::ios::in);
+ if ( ipstream.fail() ) {
+ perror(("Couldn't read config file " + Folders::getConfigFilePath()).c_str());
return false;
}
char setting[256];