Skip to content
Snippets Groups Projects
Commit d7bd18ba authored by Auke Klazema's avatar Auke Klazema
Browse files

SW-595: Move aditional search path for config files to config locator

parent 34b32f89
No related branches found
No related tags found
No related merge requests found
...@@ -45,11 +45,15 @@ public: ...@@ -45,11 +45,15 @@ public:
#define CONFIG_SUB_DIR "etc" #define CONFIG_SUB_DIR "etc"
// Create a ConfigLocator with a default search path. // Create a ConfigLocator with a default search path.
ConfigLocator() : FileLocator() ConfigLocator() : FileLocator() {
{ setSubdir(CONFIG_SUB_DIR); } setSubdir(CONFIG_SUB_DIR);
addPathAtFront("$HOME/.lofar");
}
// Create a ConfigLocator with a predefined search path. // Create a ConfigLocator with a predefined search path.
explicit ConfigLocator (const string& aPath) : FileLocator(aPath) explicit ConfigLocator (const string& aPath) : FileLocator(aPath) {
{ setSubdir(CONFIG_SUB_DIR); } setSubdir(CONFIG_SUB_DIR);
addPathAtFront("$HOME/.lofar");
}
private: private:
ConfigLocator(const ConfigLocator& that); ConfigLocator(const ConfigLocator& that);
......
...@@ -242,7 +242,7 @@ string FileLocator::locate (const string& aFile) ...@@ -242,7 +242,7 @@ string FileLocator::locate (const string& aFile)
else { // test subdir else { // test subdir
fullname += itsSubdir + "/" + aFile; fullname += itsSubdir + "/" + aFile;
} }
std::cout << "Searching for : " << fullname << std::endl;
result = stat(fullname.c_str(), &fileStat); result = stat(fullname.c_str(), &fileStat);
if (result == 0) { // found? if (result == 0) { // found?
return (fullname); return (fullname);
......
...@@ -112,11 +112,10 @@ void GCFScheduler::init(int argc, char** argv, const string& logfile) ...@@ -112,11 +112,10 @@ void GCFScheduler::init(int argc, char** argv, const string& logfile)
// Try to open the log_prop file, if process has its own log_prop file then use it // Try to open the log_prop file, if process has its own log_prop file then use it
// the INIT_LOGGER otherwise use the default mac.log_prop // the INIT_LOGGER otherwise use the default mac.log_prop
ConfigLocator aCL; ConfigLocator aCL;
aCL.addPathAtFront("$HOME/.lofar"); // Make it search in the user directroy first
string procName(basename(argv[0])); string procName(basename(argv[0]));
string logPropFile(procName + ".log_prop"); string logPropFile(procName + ".log_prop");
// First try logpropfile <task>.log_prop
// First try logpropfile <task>.log_prop
if (aCL.locate(logPropFile) == "") { if (aCL.locate(logPropFile) == "") {
// locator could not find it try defaultname // locator could not find it try defaultname
logPropFile = "mac.log_prop"; logPropFile = "mac.log_prop";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment