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:
16
src/util.cpp
16
src/util.cpp
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user