Ignore empty CONFIG_DIR for validators file (RIPD-1221)

This commit is contained in:
wilsonianb
2016-07-01 14:51:22 -07:00
committed by seelabs
parent e29163e922
commit b72724a4a4
2 changed files with 14 additions and 10 deletions

View File

@@ -440,7 +440,7 @@ void Config::loadFromString (std::string const& fileContents)
Throw<std::runtime_error> (
"Invalid path specified in [" SECTION_VALIDATORS_FILE "]");
if (!validatorsFile.is_absolute())
if (!validatorsFile.is_absolute() && !CONFIG_DIR.empty())
validatorsFile = CONFIG_DIR / validatorsFile;
if (!boost::filesystem::exists (validatorsFile))
@@ -454,7 +454,7 @@ void Config::loadFromString (std::string const& fileContents)
"Invalid file specified in [" SECTION_VALIDATORS_FILE "]: " +
validatorsFile.string());
}
else
else if (!CONFIG_DIR.empty())
{
validatorsFile = CONFIG_DIR / validatorsFileName;

View File

@@ -141,7 +141,7 @@ protected:
remove (toRm);
else
test_.log << "Expected " << toRm.string ()
<< " to be an empty existing directory.";
<< " to be an empty existing directory." << std::endl;
};
public:
@@ -176,12 +176,13 @@ public:
if (rmSubDir_)
rmDir (subDir_);
else
test_.log << "Skipping rm dir: " << subDir_.string ();
test_.log << "Skipping rm dir: "
<< subDir_.string () << std::endl;
}
catch (std::exception& e)
{
// if we throw here, just let it die.
test_.log << "Error in ~ConfigGuard: " << e.what ();
test_.log << "Error in ~ConfigGuard: " << e.what () << std::endl;
};
}
};
@@ -249,19 +250,21 @@ public:
using namespace boost::filesystem;
if (!boost::filesystem::exists (configFile_))
test_.log << "Expected " << configFile_.string ()
<< " to be an existing file.";
<< " to be an existing file." << std::endl;
else
remove (configFile_.string ());
if (rmDataDir_)
rmDir (dataDir_);
else
test_.log << "Skipping rm dir: " << dataDir_.string ();
test_.log << "Skipping rm dir: "
<< dataDir_.string () << std::endl;
}
catch (std::exception& e)
{
// if we throw here, just let it die.
test_.log << "Error in ~RippledCfgGuard: " << e.what ();
test_.log << "Error in ~RippledCfgGuard: "
<< e.what () << std::endl;
};
}
};
@@ -337,14 +340,15 @@ public:
using namespace boost::filesystem;
if (!boost::filesystem::exists (validatorsFile_))
test_.log << "Expected " << validatorsFile_.string ()
<< " to be an existing file.";
<< " to be an existing file." << std::endl;
else
remove (validatorsFile_.string ());
}
catch (std::exception& e)
{
// if we throw here, just let it die.
test_.log << "Error in ~ValidatorsTxtGuard: " << e.what ();
test_.log << "Error in ~ValidatorsTxtGuard: "
<< e.what () << std::endl;
};
}
};