Mercurial > projects > ldc
changeset 1537:ee6b20e7aedb
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
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Mon, 13 Jul 2009 22:56:59 +0200 |
parents | 49ae9728bea4 |
children | e4ff2e15cf5f |
files | gen/configfile.cpp |
diffstat | 1 files changed, 30 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- 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; }