Skip to content

Commit 70f532d

Browse files
k21971entrez
authored andcommitted
More whereis tweaks.
Co-authored-by: entrez <me@entrez.cc>
1 parent f850c0c commit 70f532d

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/files.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,16 @@ touch_whereis(void)
857857
void
858858
delete_whereis(void)
859859
{
860-
write_whereis(FALSE);
860+
if (program_state.something_worth_saving) {
861+
/* if we have valid data to write, just write it but specify that the
862+
* game isn't active ("playing=0") */
863+
write_whereis(FALSE);
864+
} else {
865+
/* if data may be unavailable for writing, actually unlink the file */
866+
if (strstr(whereis_file, "%n"))
867+
set_whereisfile();
868+
(void) unlink(whereis_file);
869+
}
861870
}
862871
#endif /* WHEREIS_FILE */
863872

0 commit comments

Comments
 (0)