beret: Store game status in home directory

svn path=/nixpkgs/trunk/; revision=31021
This commit is contained in:
Shea Levy 2011-12-21 18:18:15 +00:00
parent e1a96b2b88
commit f821677f67
2 changed files with 51 additions and 1 deletions

View File

@ -9,7 +9,9 @@ stdenv.mkDerivation {
NIX_CFLAGS_LINK = "-lgcc_s";
patchPhase = ''
patches = [ ./use-home-dir.patch ];
postPatch = ''
sed -i 's@RESOURCE_PATH ""@RESOURCE_PATH "'$out'/share/"@' game.c
'';

View File

@ -0,0 +1,48 @@
diff -Naur beret-beret-orig/game.c beret-beret/game.c
--- beret-beret-orig/game.c 2011-12-17 18:51:32.000000000 -0500
+++ beret-beret/game.c 2011-12-21 13:16:37.047511020 -0500
@@ -10,12 +10,10 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#ifdef __APPLE__
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <pwd.h>
-#endif
#define CAMSCROLL 15
#define SCR_WIDTH 780
@@ -88,12 +86,8 @@
#define DIRSEP "/"
#endif
-#ifdef __APPLE__
-#define SUPPORT_PATH "Library/Application Support/Beret/"
-#define RESOURCE_PATH "Beret.app/Contents/Resources/"
-#else
+#define SUPPORT_PATH ".beret"
#define RESOURCE_PATH ""
-#endif
#define QUITMOD_WIN KMOD_ALT
#define QUITKEY_WIN SDLK_F4
@@ -812,7 +806,6 @@
int init() {
- #ifdef __APPLE__
char filestr[512];
// Get the home directory of the user.
struct passwd *pwd = getpwuid(getuid());
@@ -827,9 +820,6 @@
sprintf(filestr, "%s/saves", support_path);
mkdir(filestr, S_IRWXU);
}
- #else
- sprintf(support_path, "");
- #endif
if (SDL_Init(SDL_INIT_EVERYTHING) == -1) {
printf("Error: couldn't initialize SDL\n");