Completion: handle hidden files in complete_filenam

This commit is contained in:
Maxime Coste 2012-01-15 02:01:58 +00:00
parent 49ea6f7103
commit f673f3c334

View File

@ -30,12 +30,16 @@ CandidateList complete_filename(const std::string& prefix,
while (dirent* entry = readdir(dir))
{
std::string filename = entry->d_name;
if (filename.empty())
continue;
if (filename.substr(0, fileprefix.length()) == fileprefix)
{
std::string name = dirprefix + filename;
if (entry->d_type == DT_DIR)
name += '/';
result.push_back(name);
if (fileprefix.length() or filename[0] != '.')
result.push_back(name);
}
}
return result;