From bf89205f7d36a2d12412f5fa1d3fffac144e2daf Mon Sep 17 00:00:00 2001 From: Frits van Bommel Date: Tue, 9 Jun 2009 12:19:52 +0200 Subject: [PATCH] Look for configuration file in `/etc` and `/etc/ldc` too (absolute paths) except on Windows. Also disabled the `$PREFIX/etc/ldc` case for Windows, since the "/etc/ldc" part was #if'ed out anyway. --- gen/configfile.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/gen/configfile.cpp b/gen/configfile.cpp index d8f5847e..70bab1a6 100644 --- a/gen/configfile.cpp +++ b/gen/configfile.cpp @@ -64,18 +64,31 @@ bool ConfigFile::locate(sys::Path& p, const char* argv0, void* mainAddr, const c if (p.exists()) return true; +#if !_WIN32 + // Does Windows need something similar to these? + // 4) try the install-prefix/etc/ldc p = sys::Path(LDC_INSTALL_PREFIX); -#if !_WIN32 - // Does Windows need something similar? p.appendComponent("etc"); p.appendComponent("ldc"); -#endif p.appendComponent(filename); if (p.exists()) return true; - // 5) try next to the executable + // 5) try /etc (absolute path) + p = sys::Path("/etc"); + p.appendComponent(filename); + if (p.exists()) + return true; + + // 6) try /etc/ldc (absolute path) + p = sys::Path("/etc/ldc"); + p.appendComponent(filename); + if (p.exists()) + return true; +#endif + + // 7) try next to the executable #if _WIN32 p = ConfigGetExePath(p); #else