Merge pull request #178141 from kenranunderscore/continue-umoria-characters

umoria: fix savefile persistence (#178136); refactor and extend

authored by Guillaume Girol and committed by GitHub 2417363a a4716292

+11 -13
+11 -13
pkgs/games/umoria/default.nix
··· 8 8 }: 9 9 10 10 let 11 - savesDir = "~/.umoria/"; 11 + savesDir = "~/.umoria"; 12 12 in 13 13 gcc9Stdenv.mkDerivation rec { 14 14 pname = "umoria"; ··· 38 38 39 39 RUNDIR=\$(mktemp -d) 40 40 41 - cleanup() { 42 - rm -rf \$RUNDIR 43 - } 44 - 45 - trap cleanup EXIT 41 + # Print the directory, so users have access to dumps, and let the system 42 + # take care of cleaning up temp files. 43 + echo "Running umoria in \$RUNDIR" 46 44 47 45 cd \$RUNDIR 48 - mkdir data 49 - 50 - for i in $out/data/*; do 51 - ln -s \$i "data/\$(basename \$i)" 52 - done 46 + ln -sn $out/data \$RUNDIR/data 53 47 54 48 mkdir -p ${savesDir} 55 49 [[ ! -f ${savesDir}/scores.dat ]] && touch ${savesDir}/scores.dat 56 50 ln -s ${savesDir}/scores.dat scores.dat 57 51 58 - $out/.umoria-unwrapped 52 + if [ \$# -eq 0 ]; then 53 + $out/.umoria-unwrapped ${savesDir}/game.sav 54 + else 55 + $out/.umoria-unwrapped "\$@" 56 + fi 59 57 EOF 60 58 61 59 chmod +x $out/bin/umoria ··· 74 72 ''; 75 73 platforms = platforms.unix; 76 74 badPlatforms = [ "aarch64-darwin" ]; 77 - maintainers = [ maintainers.aciceri ]; 75 + maintainers = with maintainers; [ aciceri kenran ]; 78 76 license = licenses.gpl3Plus; 79 77 }; 80 78 }