diff --git a/util/env_posix.cc b/util/env_posix.cc index c249032..ffd0ffb 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -609,8 +609,12 @@ class PosixEnv : public Env { } struct ::dirent* entry; while ((entry = ::readdir(dir)) != nullptr) { + if (!(entry->d_name[0] == '.' && entry->d_name[1] == '\0' || + entry->d_name[0] == '.' && entry->d_name[1] == '.' && + entry->d_name[2] == '\0')) { result->emplace_back(entry->d_name); } + } ::closedir(dir); return Status::OK(); } diff --git a/util/env_windows.cc b/util/env_windows.cc index ae5149a..889c350 100644 --- a/util/env_windows.cc +++ b/util/env_windows.cc @@ -507,11 +507,14 @@ class WindowsEnv : public Env { do { char base_name[_MAX_FNAME]; char ext[_MAX_EXT]; - + if(!(find_data.cFileName[0] == '.' && find_data.cFileName[1] == '\0' || + find_data.cFileName[0] == '.' && find_data.cFileName[1] == '.' && + find_data.cFileName[2] == '\0')) { if (!_splitpath_s(find_data.cFileName, nullptr, 0, nullptr, 0, base_name, ARRAYSIZE(base_name), ext, ARRAYSIZE(ext))) { result->emplace_back(std::string(base_name) + ext); } + } } while (::FindNextFileA(dir_handle, &find_data)); DWORD last_error = ::GetLastError(); ::FindClose(dir_handle);