Skip to content

Commit

Permalink
Shell: Use DirIterator::SkipParentAndBaseDir
Browse files Browse the repository at this point in the history
  • Loading branch information
shannonbooth authored and awesomekling committed May 16, 2020
1 parent e5ad6a4 commit 154a6e6
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Shell/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1369,13 +1369,10 @@ int main(int argc, char** argv)

// only suggest dot-files if path starts with a dot
Core::DirIterator files(path,
token.starts_with('.') ? Core::DirIterator::NoFlags : Core::DirIterator::SkipDots);
token.starts_with('.') ? Core::DirIterator::SkipParentAndBaseDir : Core::DirIterator::SkipDots);

while (files.has_next()) {
auto file = files.next_path();
// manually skip `.' and `..'
if (file == "." || file == "..")
continue;
auto trivia = " ";
if (file.starts_with(token)) {
String file_path = String::format("%s/%s", path.characters(), file.characters());
Expand Down Expand Up @@ -1450,13 +1447,10 @@ int main(int argc, char** argv)

// only suggest dot-files if path starts with a dot
Core::DirIterator files(path,
token.starts_with('.') ? Core::DirIterator::NoFlags : Core::DirIterator::SkipDots);
token.starts_with('.') ? Core::DirIterator::SkipParentAndBaseDir : Core::DirIterator::SkipDots);

while (files.has_next()) {
auto file = files.next_path();
// manually skip `.' and `..'
if (file == "." || file == "..")
continue;
if (file.starts_with(token)) {
struct stat program_status;
String file_path = String::format("%s/%s", path.characters(), file.characters());
Expand Down

0 comments on commit 154a6e6

Please sign in to comment.