File PhantomasPC-0.9-homedir.patch of Package PhantomasPC

--- src/main.c
+++ src/main.c
@@ -8,7 +8,8 @@
 */
 
 
-
+#define _GNU_SOURCE
+#include <stdio.h>
 #include "config.h"
 
 #ifdef GP2X
@@ -90,6 +91,11 @@
 	#endif
 #endif
 
+	char *tmp;
+	asprintf(&tmp, "%s/.phantpc", getenv("HOME"));
+	if((mkdir(tmp, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) != 0) && (errno != EEXIST))
+		printf("Couldn't create save directory '%s'", tmp);
+	free(tmp);
 	p=ph_init_program(argc, argv);
 	ph_do_intro(p);
 	ph_do_menu1(p);
openSUSE Build Service is sponsored by