From 67eb19c6d2d4b4aaa593e526b625483ca5a7e207 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 18 Nov 2016 09:37:16 +0000 Subject: [PATCH] Only rely on `ignored_files` option to remove hidden files, no built in logic Fixes #929 --- src/file.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/file.cc b/src/file.cc index 16b3cf04..9620467a 100644 --- a/src/file.cc +++ b/src/file.cc @@ -401,14 +401,12 @@ CandidateList complete_filename(StringView prefix, const Regex& ignored_regex, const bool check_ignored_regex = not ignored_regex.empty() and not regex_match(fileprefix.begin(), fileprefix.end(), ignored_regex); - const bool include_hidden = fileprefix.substr(0_byte, 1_byte) == "."; const bool only_dirs = (flags & FilenameFlags::OnlyDirectories); - auto filter = [&ignored_regex, check_ignored_regex, include_hidden, only_dirs](const dirent& entry, struct stat& st) + auto filter = [&ignored_regex, check_ignored_regex, only_dirs](const dirent& entry, struct stat& st) { StringView name{entry.d_name}; - return (include_hidden or name.substr(0_byte, 1_byte) != ".") and - (not check_ignored_regex or not regex_match(name.begin(), name.end(), ignored_regex)) and + return (not check_ignored_regex or not regex_match(name.begin(), name.end(), ignored_regex)) and (not only_dirs or S_ISDIR(st.st_mode)); }; auto files = list_files(parsed_dirname, filter);