GitHub issue #460
This commit is contained in:
parent
e10325e133
commit
4f3f471b4c
5 changed files with 13 additions and 67 deletions
|
@ -108,43 +108,6 @@ std::vector<std::string> OSUtils::listDirectory(const char *path)
|
|||
return r;
|
||||
}
|
||||
|
||||
std::map<std::string,char> OSUtils::listDirectoryFull(const char *path)
|
||||
{
|
||||
std::map<std::string,char> r;
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
HANDLE hFind;
|
||||
WIN32_FIND_DATAA ffd;
|
||||
if ((hFind = FindFirstFileA((std::string(path) + "\\*").c_str(),&ffd)) != INVALID_HANDLE_VALUE) {
|
||||
do {
|
||||
if ((strcmp(ffd.cFileName,"."))&&(strcmp(ffd.cFileName,".."))) {
|
||||
r[ffd.cFileName] = ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) ? 'd' : 'f';
|
||||
}
|
||||
} while (FindNextFileA(hFind,&ffd));
|
||||
FindClose(hFind);
|
||||
}
|
||||
#else
|
||||
struct dirent de;
|
||||
struct dirent *dptr;
|
||||
DIR *d = opendir(path);
|
||||
if (!d)
|
||||
return r;
|
||||
dptr = (struct dirent *)0;
|
||||
for(;;) {
|
||||
if (readdir_r(d,&de,&dptr))
|
||||
break;
|
||||
if (dptr) {
|
||||
if ((strcmp(dptr->d_name,"."))&&(strcmp(dptr->d_name,".."))) {
|
||||
r[dptr->d_name] = (dptr->d_type == DT_DIR) ? 'd' : 'f';
|
||||
}
|
||||
} else break;
|
||||
}
|
||||
closedir(d);
|
||||
#endif
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
long OSUtils::cleanDirectory(const char *path,const uint64_t olderThan)
|
||||
{
|
||||
long cleaned = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue