beret: Store game status in home directory

svn path=/nixpkgs/trunk/; revision=31021

Shea Levy f821677f e1a96b2b

+51 -1
+3 -1
pkgs/games/beret/default.nix
··· 9 9 10 10 NIX_CFLAGS_LINK = "-lgcc_s"; 11 11 12 - patchPhase = '' 12 + patches = [ ./use-home-dir.patch ]; 13 + 14 + postPatch = '' 13 15 sed -i 's@RESOURCE_PATH ""@RESOURCE_PATH "'$out'/share/"@' game.c 14 16 ''; 15 17
+48
pkgs/games/beret/use-home-dir.patch
··· 1 + diff -Naur beret-beret-orig/game.c beret-beret/game.c 2 + --- beret-beret-orig/game.c 2011-12-17 18:51:32.000000000 -0500 3 + +++ beret-beret/game.c 2011-12-21 13:16:37.047511020 -0500 4 + @@ -10,12 +10,10 @@ 5 + #include <stdlib.h> 6 + #include <stdio.h> 7 + #include <string.h> 8 + -#ifdef __APPLE__ 9 + #include <sys/stat.h> 10 + #include <unistd.h> 11 + #include <errno.h> 12 + #include <pwd.h> 13 + -#endif 14 + 15 + #define CAMSCROLL 15 16 + #define SCR_WIDTH 780 17 + @@ -88,12 +86,8 @@ 18 + #define DIRSEP "/" 19 + #endif 20 + 21 + -#ifdef __APPLE__ 22 + -#define SUPPORT_PATH "Library/Application Support/Beret/" 23 + -#define RESOURCE_PATH "Beret.app/Contents/Resources/" 24 + -#else 25 + +#define SUPPORT_PATH ".beret" 26 + #define RESOURCE_PATH "" 27 + -#endif 28 + 29 + #define QUITMOD_WIN KMOD_ALT 30 + #define QUITKEY_WIN SDLK_F4 31 + @@ -812,7 +806,6 @@ 32 + 33 + int init() { 34 + 35 + - #ifdef __APPLE__ 36 + char filestr[512]; 37 + // Get the home directory of the user. 38 + struct passwd *pwd = getpwuid(getuid()); 39 + @@ -827,9 +820,6 @@ 40 + sprintf(filestr, "%s/saves", support_path); 41 + mkdir(filestr, S_IRWXU); 42 + } 43 + - #else 44 + - sprintf(support_path, ""); 45 + - #endif 46 + 47 + if (SDL_Init(SDL_INIT_EVERYTHING) == -1) { 48 + printf("Error: couldn't initialize SDL\n");