FACT++  1.0
bool DimWriteStatistics::DoesPathExist ( std::string  path,
MessageImp log 
)
static

Check if a given path exists

Parameters
paththe path to be checked
Returns
whether or not the given path exists

Definition at line 105 of file DimWriteStatistics.cc.

References MessageImp::Error().

Referenced by DataLogger::DoesPathExist(), GetUpdateInterval(), and EventBuilderWrapper::InitRunNumber().

106 {
107  namespace fs = boost::filesystem;
108 
109  if (path.empty())
110  path = ".";
111 
112  const fs::path fullPath = fs::system_complete(fs::path(path));
113 
114  if (!fs::exists(fullPath))
115  return false;
116 
117  if (!fs::is_directory(fullPath))
118  {
119  log.Error("Path given for checking '" + path + "' designate a file name. Please provide a path name only");
120  return false;
121  }
122 
123  if (access(path.c_str(), R_OK|W_OK|X_OK) != 0)
124  {
125  log.Error("Missing read, write or execute permissions on directory '" + path + "'");
126  return false;
127  }
128 
129  return true;
130 }
int Error(const std::string &str)
Definition: MessageImp.h:49

+ Here is the call graph for this function:

+ Here is the caller graph for this function: