66 std::vector< std::string > result;
75 result.push_back(std::string(entry->d_name));
98 if (getcwd(oldWD, 255) ==
nullptr)
return result;
100 if (chdir(
m_dirName.c_str()) != 0)
return result;
104 if (getcwd(absPath, 254) !=
nullptr) result = std::string(absPath) +
'/';
106 if (chdir(oldWD) != 0)
107 std::cerr <<
"Warning : Could not go to previous working directory. (" 108 << __FILE__ <<
":" << __LINE__ <<
")" << std::endl;
Cross-platform directory utility.
std::string m_dirName
The directory path.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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.