1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
From: Markus Koschany <apo@debian.org>
Date: Fri, 28 Dec 2012 18:51:31 +0100
Subject: change config file path
Save and load the config file, .brainparty, in the user's $HOME
directory.
---
BPGame.cpp | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/BPGame.cpp b/BPGame.cpp
index a5a0c6c..e18052f 100644
--- a/BPGame.cpp
+++ b/BPGame.cpp
@@ -1293,8 +1293,11 @@ void BPGame::LoadSettings() {
Secret1 = Secret2 = Secret3 = Secret4 = false;
NumUnlockedGames = 0;
+ char path[1024];
+ snprintf(path, 1024, "%s/%s", getenv("HOME"), ".brainparty" );
+
ifstream ifs;
- ifs.open(".brainparty");
+ ifs.open(path);
FirstRun = false;
@@ -1424,8 +1427,10 @@ void BPGame::LoadSettings() {
}
void BPGame::SaveSettings() {
+ char path[1024];
+ snprintf(path, 1024, "%s/%s", getenv("HOME"), ".brainparty" );
ofstream savefile;
- savefile.open(".brainparty");
+ savefile.open(path);
savefile << EnableSound << endl;
savefile << EnableMusic << endl;
savefile << endl;
|