16 if(pathDir ==
""){
return PString(
".");}
17 else if(pathDir[0] ==
'/'){
return pathDir;}
27 if(pathDir ==
""){
return pathDir;}
28 else if(pathDir[pathDir.size() - 1lu] ==
'/'){
return pathDir;}
29 else if(pathDir[pathDir.size() - 1lu] !=
'/'){
return PPath(pathDir +
PString(
"/"));}
39 if(basePath ==
""){
return PString(
"./");}
42 PPath listMatchingPath(
"");
46 DIR * dp = opendir(completedPathDir.c_str());
47 dirent * dptr = readdir(dp);
49 PPath pathName(dptr->d_name);
50 if(pathName !=
"." && pathName !=
".."){
51 listMatchingPath += prefixPath + pathName +
PString(
"\n");
60 DIR * dp = opendir(completedPathDir.c_str());
62 dirent * dptr = readdir(dp);
64 PPath pathName(dptr->d_name);
65 if(pathName !=
"." && pathName !=
".."){
67 listMatchingPath += prefixPath + pathName +
PString(
"\n");
76 return listMatchingPath;
84 if(basePath ==
""){
return PString(
"./");}
85 PPath listMatchingPath(
"");
87 DIR * dp = opendir(basePath.c_str());
88 dirent * dptr = readdir(dp);
90 if(dptr->d_type == DT_DIR){
91 PPath pathName(dptr->d_name);
92 if(pathName !=
"." && pathName !=
".."){
93 listMatchingPath += basePath / pathName +
PString(
"\n");
100 DIR * dp = opendir(baseDir.c_str());
102 dirent * dptr = readdir(dp);
104 if(dptr->d_type == DT_DIR){
105 PPath pathName(dptr->d_name);
106 if(pathName !=
"." && pathName !=
".."){
108 listMatchingPath += baseDir / pathName +
PString(
"\n");
117 return listMatchingPath;
Path of a directory or a file.
PPath getParentDirectory() const
Get path of parent directory of current path.
bool isDirectoryExist() const
Say if the current directory path does exist.
bool isFileExist() const
Say if the current file path does exist.
PPath getFileName() const
Get the name of the file, from last char to /.
bool isSameBegining(const PString &beginStr) const
Say if the current PString has the same begining of beginStr.
PPath prefixPathDir(const PPath &pathDir)
Complete the path directory with a prefix.
PPath path_completion_dirOnly(const PPath &basePath)
Return all directories only which match the basePath.
PPath path_completion_all(const PPath &basePath)
Return all path/files which match the basePath.
PPath completePathDir(const PPath &pathDir)
Complete the path directory.