LibCore: Add "static bool Core::File::exists(filename)"

This commit is contained in:
Andreas Kling 2020-02-12 21:17:00 +01:00
commit 90fec9c732
Notes: sideshowbarker 2024-07-19 09:22:04 +09:00
2 changed files with 8 additions and 0 deletions

View file

@ -100,4 +100,10 @@ bool File::is_directory(const String& filename)
return S_ISDIR(st.st_mode);
}
bool File::exists(const String& filename)
{
struct stat st;
return stat(filename.characters(), &st) == 0;
}
}