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

LibCore+Everywhere: Move OpenMode out of IODevice

...and make it an enum class so people don't omit "OpenMode".
This commit is contained in:
Ali Mohammad Pur 2021-05-12 13:56:43 +04:30 committed by Linus Groh
parent 422ef7904e
commit a91a49337c
113 changed files with 180 additions and 177 deletions

View file

@ -220,7 +220,7 @@ void Editor::add_to_history(const String& line)
bool Editor::load_history(const String& path)
{
auto history_file = Core::File::construct(path);
if (!history_file->open(Core::IODevice::ReadOnly))
if (!history_file->open(Core::OpenMode::ReadOnly))
return false;
auto data = history_file->read_all();
auto hist = StringView { data.data(), data.size() };
@ -279,7 +279,7 @@ bool Editor::save_history(const String& path)
{
Vector<HistoryEntry> final_history { { "", 0 } };
{
auto file_or_error = Core::File::open(path, Core::IODevice::ReadWrite, 0600);
auto file_or_error = Core::File::open(path, Core::OpenMode::ReadWrite, 0600);
if (file_or_error.is_error())
return false;
auto file = file_or_error.release_value();
@ -294,7 +294,7 @@ bool Editor::save_history(const String& path)
[](const HistoryEntry& left, const HistoryEntry& right) { return left.timestamp < right.timestamp; });
}
auto file_or_error = Core::File::open(path, Core::IODevice::WriteOnly, 0600);
auto file_or_error = Core::File::open(path, Core::OpenMode::WriteOnly, 0600);
if (file_or_error.is_error())
return false;
auto file = file_or_error.release_value();