mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 22:30:31 +00:00
Shell: Use DirIterator::SkipParentAndBaseDir
This commit is contained in:
parent
e5ad6a491e
commit
154a6e69a4
Notes:
sideshowbarker
2024-07-19 06:37:21 +09:00
Author: https://github.com/shannonbooth
Commit: 154a6e69a4
Pull-request: https://github.com/SerenityOS/serenity/pull/2245
1 changed files with 2 additions and 8 deletions
|
@ -1369,13 +1369,10 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
// only suggest dot-files if path starts with a dot
|
// only suggest dot-files if path starts with a dot
|
||||||
Core::DirIterator files(path,
|
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()) {
|
while (files.has_next()) {
|
||||||
auto file = files.next_path();
|
auto file = files.next_path();
|
||||||
// manually skip `.' and `..'
|
|
||||||
if (file == "." || file == "..")
|
|
||||||
continue;
|
|
||||||
auto trivia = " ";
|
auto trivia = " ";
|
||||||
if (file.starts_with(token)) {
|
if (file.starts_with(token)) {
|
||||||
String file_path = String::format("%s/%s", path.characters(), file.characters());
|
String file_path = String::format("%s/%s", path.characters(), file.characters());
|
||||||
|
@ -1450,13 +1447,10 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
// only suggest dot-files if path starts with a dot
|
// only suggest dot-files if path starts with a dot
|
||||||
Core::DirIterator files(path,
|
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()) {
|
while (files.has_next()) {
|
||||||
auto file = files.next_path();
|
auto file = files.next_path();
|
||||||
// manually skip `.' and `..'
|
|
||||||
if (file == "." || file == "..")
|
|
||||||
continue;
|
|
||||||
if (file.starts_with(token)) {
|
if (file.starts_with(token)) {
|
||||||
struct stat program_status;
|
struct stat program_status;
|
||||||
String file_path = String::format("%s/%s", path.characters(), file.characters());
|
String file_path = String::format("%s/%s", path.characters(), file.characters());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue