diff options
author | Mart G <martg_@hotmail.com> | 2021-05-14 21:05:18 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-14 23:32:10 +0200 |
commit | 758085571fdfcd89a30fa1986050407da7c4ae83 (patch) | |
tree | 571f8f1523930c9fd4fe37dee9f63ad856b72052 /Userland | |
parent | e7310ba45a5eaafd0f4a9dae241271e5de9869ba (diff) | |
download | serenity-758085571fdfcd89a30fa1986050407da7c4ae83.zip |
LibCore: Expose DirIterator's underlying file descriptor
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibCore/DirIterator.cpp | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibCore/DirIterator.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCore/DirIterator.cpp b/Userland/Libraries/LibCore/DirIterator.cpp index 3483101025..deb3f17d04 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 088bcb59e6..18fc8a218b 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; |