parent_path.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // parent_path
3 //
4 // Return the parent of the supplied path. If this was a filename
5 // without path, return "." otherwise return either the containing
6 // directory if the path represents a file; or the parent directory if
7 // the path represents a directory.
8 //
9 // This is a thin wrapper around boost::filesystem::path::parent_path().
10 ////////////////////////////////////////////////////////////////////////
12 #include "boost/filesystem.hpp"
13 
16 {
18  boost::filesystem::path parent_path(
19  boost::filesystem::path(in_path).parent_path());
20  if (parent_path.empty()) {
21  result = ".";
22  } else {
23  result = parent_path.native();
24  }
25  return result;
26 }
static QCString result
std::string string
Definition: nybbler.cc:12
std::string parent_path(std::string const &path)
Definition: parent_path.cc:15