32   #include <sys/types.h>    33   #include <sys/param.h>    47 bool sortCallback(
const std::string & a, 
const std::string & b)
    52 int sortCallback(
const struct dirent ** a, 
const struct dirent ** b)
   108                 std::string lastName;
   109                 bool endOfDir = 
false;
   122                 WIN32_FIND_DATA fileInformation;
   124                 wchar_t * pathAll = createWCharFromChar((
path_+
"\\*").c_str());
   125                 HANDLE hFile  = ::FindFirstFile(pathAll, &fileInformation);
   128                 HANDLE hFile  = ::FindFirstFile((
path_+
"\\*").c_str(), &fileInformation);
   130                 if(hFile != INVALID_HANDLE_VALUE)
   135                                 char * fileName = createCharFromWChar(fileInformation.cFileName);
   139                                 fileNames_.push_back(fileInformation.cFileName);
   141                         } 
while(::FindNextFile(hFile, &fileInformation) == TRUE);
   144                         std::sort(vFileNames.begin(), vFileNames.end(), 
sortCallback);
   149                 struct dirent ** nameList = 0;
   151                 if(nameList && nameListSize>0)
   153                         for (
int i=0;i<nameListSize;++i)
   163                 std::list<std::string>::iterator iter = 
fileNames_.begin();
   169                            iter->compare(
".") != 0 &&
   170                            iter->compare(
"..") != 0)
   192                 if(!lastName.empty())
   197                                 if(lastName.compare(*iter) == 0)
   204                         if(endOfDir && found)
   223         std::string fileName;
   243         wchar_t * wDirPath = createWCharFromChar(dirPath.c_str());
   244         DWORD dwAttrib = GetFileAttributes(wDirPath);
   247         DWORD dwAttrib = GetFileAttributes(dirPath.c_str());
   249         r = (dwAttrib != INVALID_FILE_ATTRIBUTES && (dwAttrib & FILE_ATTRIBUTE_DIRECTORY));
   252         if((dp  = opendir(dirPath.c_str())) != NULL)
   264         std::string dir = filePath;
   265         int i=(int)dir.size()-1;
   268                 if(dir[i] == 
'/' || dir[i] == 
'\\')
   273                         while(i>=0 && (dir[i] == 
'/' || dir[i] == 
'\\'))
   304         buffer = _getcwd(NULL, 0);
   306         buffer = getcwd(NULL, MAXPATHLEN);
   313                 if(trailingSeparator)
   326         status = _mkdir(dirPath.c_str());
   328         status = mkdir(dirPath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
   337         status = _rmdir(dirPath.c_str());
   339         status = rmdir(dirPath.c_str());
   349         wchar_t wProfilePath[250];
   350         ExpandEnvironmentStrings(L
"%userprofile%",wProfilePath,250);
   351         char * profilePath = createCharFromWChar(wProfilePath);
   353         delete [] profilePath;
   355         char profilePath[250];
   356         ExpandEnvironmentStrings(
"%userprofile%",profilePath,250);
   360         path = getenv(
"HOME");
 static std::string homeDir()
int sortCallback(const dirent **a, const dirent **b)
static bool makeDir(const std::string &dirPath)
int uStrNumCmp(const std::string &a, const std::string &b)
std::list< std::string > fileNames_
static std::string getDir(const std::string &filePath)
UDirectory(const std::string &path="", const std::string &extensions="")
static std::string separator()
UDirectory & operator=(const UDirectory &dir)
Some conversion functions. 
std::string getExtension()
Wrappers of STL for convenient functions. 
std::list< std::string > uSplit(const std::string &str, char separator=' ')
std::vector< std::string > extensions_
static std::string currentDir(bool trailingSeparator=false)
void setPath(const std::string &path, const std::string &extensions="")
std::list< std::string >::iterator iFileName_
std::list< V > uVectorToList(const std::vector< V > &v)
std::vector< V > uListToVector(const std::list< V > &list)
std::string getNextFileName()
static bool removeDir(const std::string &dirPath)
static bool exists(const std::string &dirPath)