From 38e8e99565f06621a72b4ccb92a8ea9fb87a1c17 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 12 May 2024 08:06:41 -0400 Subject: [PATCH] Windows symbols copying Avoid leaving outdated symbols file in place when there is a newer one. --- sys/windows/windmain.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/sys/windows/windmain.c b/sys/windows/windmain.c index dfd5fc846..5c928db86 100644 --- a/sys/windows/windmain.c +++ b/sys/windows/windmain.c @@ -410,9 +410,9 @@ update_file( void copy_symbols_content(void) { - char dst_path[MAX_PATH], - interim_path[MAX_PATH], - orig_path[MAX_PATH]; + char dst_path[MAX_PATH], interim_path[MAX_PATH], orig_path[MAX_PATH]; + + boolean no_template = FALSE; /* Using the SYSCONFPREFIX path, lock it so that it does not change */ fqn_prefix_locked[SYSCONFPREFIX] = TRUE; @@ -424,13 +424,28 @@ copy_symbols_content(void) strcpy(dst_path, gf.fqn_prefix[SYSCONFPREFIX]); strcat(dst_path, SYMBOLS); - if (!file_exists(interim_path) || file_newer(orig_path, interim_path)) + if (!file_exists(orig_path)) { + char alt_orig_path[MAX_PATH]; + + strcpy(alt_orig_path, gf.fqn_prefix[DATAPREFIX]); + strcat(alt_orig_path, SYMBOLS); + if (file_exists(alt_orig_path)) { + no_template = TRUE; + /* symbols -> symbols.template */ + copy_file(gf.fqn_prefix[DATAPREFIX], SYMBOLS_TEMPLATE, + gf.fqn_prefix[DATAPREFIX], SYMBOLS, TRUE); + } + } + if (!file_exists(interim_path) || file_newer(orig_path, interim_path)) { + /* symbols.template -> symbols.template */ copy_file(gf.fqn_prefix[SYSCONFPREFIX], SYMBOLS_TEMPLATE, gf.fqn_prefix[DATAPREFIX], SYMBOLS_TEMPLATE, TRUE); - - if (!file_exists(dst_path) || file_newer(interim_path, dst_path)) + } + if (!file_exists(dst_path) || file_newer(interim_path, dst_path)) { + /* symbols.template -> symbols */ copy_file(gf.fqn_prefix[SYSCONFPREFIX], SYMBOLS, - gf.fqn_prefix[SYSCONFPREFIX], SYMBOLS_TEMPLATE, TRUE); + gf.fqn_prefix[SYSCONFPREFIX], SYMBOLS_TEMPLATE, TRUE); + } } void copy_sysconf_content(void)