File: change-config-file-path.patch

package info (click to toggle)
brainparty 0.61%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,656 kB
  • sloc: cpp: 12,991; objc: 252; makefile: 61
file content (40 lines) | stat: -rw-r--r-- 1,025 bytes parent folder | download | duplicates (5)
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;