63 std::vector< std::string > result;
72 result.push_back(std::string(entry->d_name));
95 if (getcwd(oldWD, 255) ==
nullptr)
return result;
97 if (chdir(
m_dirName.c_str()) != 0)
return result;
101 if (getcwd(absPath, 254) !=
nullptr) result = std::string(absPath) +
'/';
103 if (chdir(oldWD) != 0)
104 std::cerr <<
"Warning : Could not go to previous working directory. (" 105 << __FILE__ <<
":" << __LINE__ <<
")" << std::endl;
Cross-platform directory utility.
std::string m_dirName
The directory path.
gum is the global namespace for all aGrUM entities
DIR * m_dirPtr
A pointer towards the Directory stream.
bool isValid() const
Returns true if directory has been opened, false otherwise.
Directory & operator=(const Directory &d)
Copy operator.
std::string absolutePath() const
Returns directory absolute path.
std::vector< std::string > entries() const
Return directory content.
Directory parent() const
Returns directory parent.
Contains usefull methods to work with files and directories.
static bool isDir(const std::string &path)
&brief Return true if directory is a valid directory, false otherwise.
std::string path() const
Returns directory path.