SYSCF_FILE corrections for windows

Changes to be committed:
	modified:   src/files.c
	modified:   sys/share/pcmain.c

Related to #H4170, bz274

The current startup code seeks out the SYSCONFPREFIX using:
	envp = nh_getenv("COMMONPROGRAMFILES");
which is fine and usually translates to something like
"C:\\Program Files (x86)\\Common Files\\
NetHack then tacks on the NetHack subfolder to the path
"C:\\Program Files (x86)\\Common Files\\NetHack\\"

That should always be the definitive location.

However, in the event that there is no SYSCF_FILE actually
located at that system-wide spot (and ONLY in that event),
fall back to a secondary location of HACKDIR for locating
the SYSCF_FILE.

Also, there's some explicit tweaking added for the Microsoft
visual studio compiler debug execution to all a debug
session to correctly locate things. By default, on a
visual studio build, the executables are linked down in
subfolders of the build directory (Release, or Debug,
depending on visual studio build configuration options).
This commit is contained in:
nhmall
2016-01-01 20:33:14 -05:00
parent c70d466325
commit 61148f05bb
2 changed files with 61 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 files.c $NHDT-Date: 1451001643 2015/12/25 00:00:43 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.197 $ */
/* NetHack 3.6 files.c $NHDT-Date: 1451697801 2016/01/02 01:23:21 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.199 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -3355,7 +3355,11 @@ assure_syscf_file()
* VMS overrides open() usage with a macro which requires it.
*/
#ifndef VMS
# if defined(NOCWD_ASSUMPTIONS) && defined(WIN32)
fd = open(fqname(SYSCF_FILE, SYSCONFPREFIX, 0), O_RDONLY);
# else
fd = open(SYSCF_FILE, O_RDONLY);
# endif
#else
fd = open(SYSCF_FILE, O_RDONLY, 0);
#endif