From 88f1d2f365a42db97058815b5c167056140c089f Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 6 Nov 2019 16:44:25 -0500 Subject: [PATCH] don't hardcode the version id in windmain --- sys/winnt/windmain.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/winnt/windmain.c b/sys/winnt/windmain.c index 4574e9d1a..6ef125c09 100644 --- a/sys/winnt/windmain.c +++ b/sys/winnt/windmain.c @@ -12,6 +12,9 @@ #include #include #include +#if !defined(VERSION_MAJOR) +#include "patchlevel.h" +#endif #if !defined(SAFEPROCS) #error You must #define SAFEPROCS to build windmain.c @@ -102,7 +105,7 @@ build_known_folder_path( get_known_folder_path(folder_id, path, path_size); strcat(path, "\\NetHack\\"); create_directory(path); - strcat(path, "3.6\\"); + Sprintf(eos(path), "%d.%d\\", VERSION_MAJOR, VERSION_MINOR); create_directory(path); } @@ -196,6 +199,7 @@ set_default_prefix_locations(const char *programPath) static char nethack_per_user_data_path[MAX_PATH]; static char nethack_global_data_path[MAX_PATH]; static char sysconf_path[MAX_PATH]; + static char versioninfo[8]; strcpy(executable_path, get_executable_path()); append_slash(executable_path); @@ -228,7 +232,8 @@ set_default_prefix_locations(const char *programPath) fqn_prefix[HACKPREFIX] = hack_path; fqn_prefix[TROUBLEPREFIX] = hack_path; - build_environment_path("COMMONPROGRAMFILES", "NetHack\\3.6", sysconf_path, + Sprintf(versioninfo, "NetHack\\%d.%d", VERSION_MAJOR, VERSION_MINOR); + build_environment_path("COMMONPROGRAMFILES", versioninfo, sysconf_path, sizeof(sysconf_path)); if(!folder_file_exists(sysconf_path, SYSCF_FILE))