Sophie

Sophie

distrib > Mageia > 8 > x86_64 > by-pkgid > 6f1ba67ba6339685c5cf62810f68187d > files > 3

brainparty-0.61-9.mga8.src.rpm

Index: brainparty/BPGame.cpp
===================================================================
--- brainparty/BPGame.cpp
+++ brainparty/BPGame.cpp	2013-09-03 00:31:20.809314357 +0200
@@ -21,6 +21,7 @@
 #include "SDL_opengl.h" 
 #include "SDL_ttf.h" 
 #include <string>
+#include <pwd.h>
 
 
 #include "bombhunt.h"
@@ -1297,8 +1298,15 @@
 	Secret1 = Secret2 = Secret3 = Secret4 = false;
 	NumUnlockedGames = 0;
 
+	// Retrieve HOME and set the path to the config file
+	int myuid = getuid();
+	passwd *mypasswd = getpwuid(myuid);
+	char* homedir = mypasswd->pw_dir;
+	string configpath(homedir);
+	configpath += "/.config/brainparty.scores";
+	
 	ifstream ifs;
-	ifs.open(".brainparty");
+	ifs.open(configpath.c_str());
 	
 	FirstRun = false;
 	
@@ -1428,8 +1436,15 @@
 }
 
 void BPGame::SaveSettings() {
+	// Retrieve HOME and set the path to the config file 
+	int myuid = getuid();
+	passwd *mypasswd = getpwuid(myuid);
+	char* homedir = mypasswd->pw_dir;
+	string configpath(homedir);
+	configpath += "/.config/brainparty.scores";
+	
  	ofstream savefile;
- 	savefile.open(".brainparty");
+ 	savefile.open(configpath.c_str());
 	savefile << EnableSound << endl;
 	savefile << EnableMusic << endl;
 	savefile << endl;