nethack: use absolute paths when saving game

Have not managed to figure out why saving with a relative path
fails. Life is too short to investigate that one full Sunday though,
and this works.
This commit is contained in:
Henrik Grimler 2020-10-11 16:32:45 +02:00
parent 69528fd96a
commit 1b3ba4bcfe
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,22 @@
--- ../NetHack-NetHack-3.6.6_Released/src/files.c 2020-03-08 18:29:31.000000000 +0100
+++ ./src/files.c 2020-10-11 16:23:20.809498886 +0200
@@ -86,7 +86,7 @@
#endif
#if defined(UNIX) || defined(__BEOS__)
-#define SAVESIZE (PL_NSIZ + 13) /* save/99999player.e */
+#define SAVESIZE 128
#else
#ifdef VMS
#define SAVESIZE (PL_NSIZ + 22) /* [.save]<uid>player.e;1 */
@@ -966,9 +966,7 @@
Sprintf(SAVEF, "%s%s", encodedfnamebuf, SAVE_EXTENSION);
}
#else /* not VMS or MICRO or WIN32 */
- Sprintf(SAVEF, "save/%d%s", (int) getuid(), plname);
- if (regularize_it)
- regularize(SAVEF + 5); /* avoid . or / in name */
+ Sprintf(SAVEF, "@TERMUX_PREFIX@/games/nethackdir/save/termux_%s", plname);
#endif /* WIN32 */
#endif /* MICRO */
#endif /* VMS */

View File

@ -0,0 +1,21 @@
--- ../NetHack-NetHack-3.6.6_Released/util/recover.c 2020-03-08 18:29:31.000000000 +0100
+++ ./util/recover.c 2020-10-11 16:08:08.285499539 +0200
@@ -13,7 +13,8 @@
#endif
#include "config.h"
-#if !defined(O_WRONLY) && !defined(LSC) && !defined(AZTEC_C)
+#if (!defined(O_WRONLY) && !defined(LSC) && !defined(AZTEC_C)) \
+ || defined(USE_FCNTL)
#include <fcntl.h>
#endif
@@ -38,7 +39,7 @@
#define Close (void) close
#ifdef UNIX
-#define SAVESIZE (PL_NSIZ + 13) /* save/99999player.e */
+#define SAVESIZE 128
#else
#ifdef VMS
#define SAVESIZE (PL_NSIZ + 22) /* [.save]<uid>player.e;1 */