1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-08 06:47:34 +00:00

HackStudio: Port to Core::Stream::File :^)

This commit is contained in:
Karol Kosek 2022-12-18 19:36:23 +01:00 committed by Andreas Kling
parent 697d6ffb1d
commit 4784ad66b2
8 changed files with 72 additions and 66 deletions

View file

@ -5,7 +5,7 @@
*/
#include "ProjectFile.h"
#include <LibCore/File.h>
#include <LibCore/Stream.h>
namespace HackStudio {
@ -54,7 +54,7 @@ void ProjectFile::create_document_if_needed() const
return;
m_document = CodeDocument::create(m_name);
auto file_or_error = Core::File::open(m_name, Core::OpenMode::ReadOnly);
auto file_or_error = Core::Stream::File::open(m_name, Core::Stream::OpenMode::Read);
if (file_or_error.is_error()) {
warnln("Couldn't open '{}': {}", m_name, file_or_error.error());
// This is okay though, we'll just go with an empty document and create the file when saving.
@ -62,7 +62,7 @@ void ProjectFile::create_document_if_needed() const
}
auto& file = *file_or_error.value();
m_could_render_text = m_document->set_text(file.read_all());
m_could_render_text = m_document->set_text(file.read_until_eof().release_value_but_fixme_should_propagate_errors());
}
}