# HG changeset patch # User Christian Kamm # Date 1247516652 -7200 # Node ID 49ae9728bea4e229de931f932c7e9246542674cf # Parent 61f12f4651b52b737090c6eff718334790892788 Check for ldc.conf next to the ldc binary before home and etc. The new search order is * current working directory * next to executable * user home directory * prefix/etc * prefix/etc/ldc * /etc * /etc/ldc diff -r 61f12f4651b5 -r 49ae9728bea4 gen/configfile.cpp --- a/gen/configfile.cpp Mon Jul 13 20:16:15 2009 +0200 +++ b/gen/configfile.cpp Mon Jul 13 22:24:12 2009 +0200 @@ -26,19 +26,26 @@ bool ConfigFile::locate(sys::Path& p, const char* argv0, void* mainAddr, const char* filename) { - // 1) try the current working dir + // try the current working dir p = sys::Path::GetCurrentDirectory(); p.appendComponent(filename); if (p.exists()) return true; - // 2) try the user home dir + // try next to the executable + p = sys::Path::GetMainExecutable(argv0, mainAddr); + p.eraseComponent(); + p.appendComponent(filename); + if (p.exists()) + return true; + + // try the user home dir p = sys::Path::GetUserHomeDirectory(); p.appendComponent(filename); if (p.exists()) return true; - // 3) try the install-prefix/etc + // try the install-prefix/etc p = sys::Path(LDC_INSTALL_PREFIX); #if !_WIN32 // Does Windows need something similar? @@ -51,7 +58,7 @@ #if !_WIN32 // Does Windows need something similar to these? - // 4) try the install-prefix/etc/ldc + // try the install-prefix/etc/ldc p = sys::Path(LDC_INSTALL_PREFIX); p.appendComponent("etc"); p.appendComponent("ldc"); @@ -59,26 +66,19 @@ if (p.exists()) return true; - // 5) try /etc (absolute path) + // try /etc (absolute path) p = sys::Path("/etc"); p.appendComponent(filename); if (p.exists()) return true; - // 6) try /etc/ldc (absolute path) + // 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 - p = sys::Path::GetMainExecutable(argv0, mainAddr); - p.eraseComponent(); - p.appendComponent(filename); - if (p.exists()) - return true; - return false; }