X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FSettings.cpp;h=42d5d352c3a83dbe1b4ae027ca4dea311a8c1926;hb=20e924d;hp=8258becbd1ad9c365433c91e43c39f7f02ded447;hpb=3b325285c15e47e75ad5c9db05f7105f8b5af387;p=lugaru.git diff --git a/Source/Settings.cpp b/Source/Settings.cpp index 8258bec..42d5d35 100644 --- a/Source/Settings.cpp +++ b/Source/Settings.cpp @@ -21,6 +21,7 @@ along with Lugaru. If not, see . #include "Settings.h" #include "Game.h" #include "Input.h" +#include "Utils/Folders.h" using namespace Game; @@ -79,7 +80,12 @@ void SaveSettings() 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"; @@ -167,9 +173,10 @@ void SaveSettings() 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];