Look for configuration file in folder etc relative to executable.

Fixes issue #195.
This commit is contained in:
kai
2012-10-14 00:25:08 +02:00
parent 83d14c54da
commit b50c6a8026

View File

@@ -61,6 +61,19 @@ bool ConfigFile::locate(sys::Path& p, const char* argv0, void* mainAddr, const c
// system configuration
// try in etc relative to the executable: exe\..\etc
// do not use .. in path because of security risks
p = sys::Path::GetMainExecutable(argv0, mainAddr);
p.eraseComponent();
p.eraseComponent();
if (!p.isEmpty())
{
p.appendComponent("etc");
p.appendComponent(filename);
if (sys::fs::exists(p.str()))
return true;
}
#if _WIN32
// try the install-prefix
p = sys::Path(LDC_INSTALL_PREFIX);