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