LibCore: Add Core::Stream::File::exists()

This commit is contained in:
Ariel Don 2022-05-15 10:36:19 -05:00 committed by Andreas Kling
commit 244357472a
Notes: sideshowbarker 2024-07-17 10:45:15 +09:00
2 changed files with 6 additions and 0 deletions

View file

@ -117,6 +117,11 @@ ErrorOr<NonnullOwnPtr<File>> File::adopt_fd(int fd, OpenMode mode)
return file;
}
bool File::exists(StringView filename)
{
return !Core::System::stat(filename).is_error();
}
int File::open_mode_to_options(OpenMode mode)
{
int flags = 0;