ListDir不再返回.和..

This commit is contained in:
Kirigaya Kazuto 2019-08-10 21:35:37 +08:00
parent 221ec0708d
commit eca430ca69

View File

@ -19,6 +19,8 @@ vector<FileInfo> ListDir(const std::string& dirName)
{ {
FileInfo f; FileInfo f;
f.name = std::string(findData.cFileName); f.name = std::string(findData.cFileName);
if (f.name == "." || f.name == "..")
continue;
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{ {
f.type = 1; f.type = 1;