Feature - #352 rc file should support includes

- Added include file support to Config.cpp.
- Implemented isAbsolutePath helper.
- Added unit tests for isAbsolutePath.
- Fixed small bug in bug.bulk.t.
- Added TODO items to config.t.cpp.
This commit is contained in:
Paul Beckingham 2009-12-09 17:21:09 -05:00
parent 8d43a35ca4
commit 0780919c2e
8 changed files with 64 additions and 4 deletions

View file

@ -355,6 +355,13 @@ std::string expandPath (const std::string& in)
copy.replace (tilde, 1, pw->pw_dir);
}
else if ((tilde = copy.find ("~")) != std::string::npos)
{
struct passwd* pw = getpwuid (getuid ());
std::string home = pw->pw_dir;
home += "/";
copy.replace (tilde, 1, home);
}
else if ((tilde = copy.find ("~")) != std::string::npos)
{
std::string::size_type slash;
if ((slash = copy.find ("/", tilde)) != std::string::npos)
@ -369,6 +376,15 @@ std::string expandPath (const std::string& in)
return copy;
}
////////////////////////////////////////////////////////////////////////////////
bool isAbsolutePath (const std::string& in)
{
if (in.length () && in[0] == '/')
return true;
return false;
}
////////////////////////////////////////////////////////////////////////////////
// On Solaris no flock function exists.
#ifdef SOLARIS