# HG changeset patch # User Christian Kamm # Date 1247518619 -7200 # Node ID ee6b20e7aedb9b1c615298271948dffb8154ecb3 # Parent 49ae9728bea4e229de931f932c7e9246542674cf Change back the ldc.conf search path and add ~/.ldc New one: cwd, ~/.ldc, prefix/etc, prefix/etc/ldc, /etc, /etc/ldc, next-to-binary diff -r 49ae9728bea4 -r ee6b20e7aedb gen/configfile.cpp --- a/gen/configfile.cpp Mon Jul 13 22:24:12 2009 +0200 +++ b/gen/configfile.cpp Mon Jul 13 22:56:59 2009 +0200 @@ -26,37 +26,46 @@ bool ConfigFile::locate(sys::Path& p, const char* argv0, void* mainAddr, const char* filename) { + // temporary configuration + // try the current working dir p = sys::Path::GetCurrentDirectory(); p.appendComponent(filename); if (p.exists()) return true; - // try next to the executable - p = sys::Path::GetMainExecutable(argv0, mainAddr); - p.eraseComponent(); + // user configuration + + // try ~/.ldc + p = sys::Path::GetUserHomeDirectory(); + p.appendComponent(".ldc"); p.appendComponent(filename); if (p.exists()) return true; - - // try the user home dir + +#if _WIN32 + // try home dir p = sys::Path::GetUserHomeDirectory(); p.appendComponent(filename); if (p.exists()) return true; - - // try the install-prefix/etc +#endif + + // system configuration + +#if _WIN32 + // try the install-prefix p = sys::Path(LDC_INSTALL_PREFIX); -#if !_WIN32 - // Does Windows need something similar? - p.appendComponent("etc"); -#endif p.appendComponent(filename); if (p.exists()) return true; - -#if !_WIN32 - // Does Windows need something similar to these? +#else + // try the install-prefix/etc + p = sys::Path(LDC_INSTALL_PREFIX); + p.appendComponent("etc"); + p.appendComponent(filename); + if (p.exists()) + return true; // try the install-prefix/etc/ldc p = sys::Path(LDC_INSTALL_PREFIX); @@ -79,6 +88,13 @@ return true; #endif + // try next to the executable + p = sys::Path::GetMainExecutable(argv0, mainAddr); + p.eraseComponent(); + p.appendComponent(filename); + if (p.exists()) + return true; + return false; }