do away with symbols.template in windows

If the one provided in the zip/distribution is newer, replace
the one used by the game after renaming the current one to
symbols.save.

If the one used by the game is newer, do nothing with it.
This commit is contained in:
nhmall
2022-01-29 13:04:20 -05:00
parent 9b38353833
commit 721db76189
3 changed files with 10 additions and 7 deletions

View File

@@ -772,7 +772,7 @@ CLEAN_FILE += $(NHTARGET) $(NHOBJS) $(NHRES)
all: install
TO_INSTALL = $(GAMEDIR)/NetHack.exe $(RTARGETS) \
$(addprefix $(GAMEDIR)/, $(addsuffix .template, sysconf symbols .nethackrc) \
$(addprefix $(GAMEDIR)/, $(addsuffix .template, sysconf .nethackrc) \
Guidebook.txt NetHack.txt license opthelp record)
ifeq "$(USE_LUADLL)" "Y"
@@ -798,7 +798,7 @@ ifneq "$(USE_DLB)" "Y"
endif
@echo NetHack is up to date.
$(GAMEDIR)/symbols.template: $(DAT)/symbols
$(GAMEDIR)/symbols: $(DAT)/symbols
cp $< $@
$(GAMEDIR)/NetHack.txt: $(DOC)/nethack.txt

View File

@@ -971,7 +971,7 @@ $(O)install.tag: $(DAT)\data $(DAT)\rumors $(DAT)\oracles \
if exist $(DAT)\ttyoptions copy $(DAT)\ttyoptions $(GAMEDIR)
! ENDIF
if exist $(MSWSYS)\sysconf.template copy $(MSWSYS)\sysconf.template $(GAMEDIR)
if exist $(DAT)\symbols copy $(DAT)\symbols $(GAMEDIR)\symbols.template
if exist $(DAT)\symbols copy $(DAT)\symbols $(GAMEDIR)\symbols
if exist $(DOC)\guidebook.txt copy $(DOC)\guidebook.txt $(GAMEDIR)\Guidebook.txt
if exist $(DOC)\nethack.txt copy $(DOC)\nethack.txt $(GAMEDIR)\NetHack.txt
@if exist $(GAMEDIR)\NetHack.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHack.PDB to conserve space

View File

@@ -355,15 +355,16 @@ void copy_sysconf_content()
update_file(g.fqn_prefix[SYSCONFPREFIX], SYSCF_TEMPLATE,
g.fqn_prefix[DATAPREFIX], SYSCF_TEMPLATE, FALSE);
update_file(g.fqn_prefix[SYSCONFPREFIX], SYMBOLS_TEMPLATE,
g.fqn_prefix[DATAPREFIX], SYMBOLS_TEMPLATE, FALSE);
// update_file(g.fqn_prefix[SYSCONFPREFIX], SYMBOLS_TEMPLATE,
// g.fqn_prefix[DATAPREFIX], SYMBOLS_TEMPLATE, FALSE);
/* If the required early game file does not exist, copy it */
copy_file(g.fqn_prefix[SYSCONFPREFIX], SYSCF_FILE,
g.fqn_prefix[DATAPREFIX], SYSCF_TEMPLATE);
update_file(g.fqn_prefix[SYSCONFPREFIX], SYMBOLS,
g.fqn_prefix[DATAPREFIX], SYMBOLS_TEMPLATE, TRUE);
g.fqn_prefix[DATAPREFIX], SYMBOLS, TRUE);
}
void copy_config_content()
@@ -1239,14 +1240,16 @@ file_newer(const char* a_path, const char* b_path)
{
struct stat a_sb;
struct stat b_sb;
double timediff;
if (stat(a_path, &a_sb))
return FALSE;
if (stat(b_path, &b_sb))
return TRUE;
timediff = difftime(a_sb.st_mtime, b_sb.st_mtime);
if(difftime(a_sb.st_mtime, b_sb.st_mtime) < 0)
if(timediff > 0)
return TRUE;
return FALSE;
}