1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:07:45 +00:00

LibCore: Create ConfigFiles with an already-open File

This moves the fallible action of opening the file, from the
constructor, into the factory methods which can propagate any errors.

The wrinkle here is that failure to open a ConfigFile in read-only mode
is allowed (and expected, since the file may not exist), and treated as
if an empty file was successfully opened.
This commit is contained in:
Sam Atkins 2022-02-06 13:58:29 +00:00 committed by Tim Flynn
parent 8260135d4d
commit b90dc408bd
2 changed files with 17 additions and 22 deletions

View file

@ -60,8 +60,7 @@ public:
String filename() const { return m_file->filename(); }
private:
explicit ConfigFile(String const& filename, AllowWriting);
explicit ConfigFile(String const& filename, int fd);
ConfigFile(String const& filename, NonnullRefPtr<File> open_file);
void reparse();