From: nhmall Date: Sat, 29 Jan 2022 18:04:20 +0000 (-0500) Subject: do away with symbols.template in windows X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=721db7618967041d2b00da53352ee84441058121;p=nethack 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. --- diff --git a/sys/windows/Makefile.mingw32 b/sys/windows/Makefile.mingw32 index 548ae868d..8a63605fd 100644 --- a/sys/windows/Makefile.mingw32 +++ b/sys/windows/Makefile.mingw32 @@ -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 diff --git a/sys/windows/Makefile.msc b/sys/windows/Makefile.msc index 5577b687a..bad64503d 100644 --- a/sys/windows/Makefile.msc +++ b/sys/windows/Makefile.msc @@ -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 diff --git a/sys/windows/windmain.c b/sys/windows/windmain.c index 78a1c48e0..c6075ce79 100644 --- a/sys/windows/windmain.c +++ b/sys/windows/windmain.c @@ -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; }