diff --git a/Userland/Libraries/LibCore/DirIterator.cpp b/Userland/Libraries/LibCore/DirIterator.cpp index 3483101025e..deb3f17d04e 100644 --- a/Userland/Libraries/LibCore/DirIterator.cpp +++ b/Userland/Libraries/LibCore/DirIterator.cpp @@ -99,4 +99,11 @@ String find_executable_in_path(String filename) return {}; } +int DirIterator::fd() const +{ + if (!m_dir) + return -1; + return dirfd(m_dir); +} + } diff --git a/Userland/Libraries/LibCore/DirIterator.h b/Userland/Libraries/LibCore/DirIterator.h index 088bcb59e6b..18fc8a218bb 100644 --- a/Userland/Libraries/LibCore/DirIterator.h +++ b/Userland/Libraries/LibCore/DirIterator.h @@ -29,6 +29,7 @@ public: bool has_next(); String next_path(); String next_full_path(); + int fd() const; private: DIR* m_dir = nullptr;