mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 12:15:09 +00:00
HackStudio: Display warning when opening binary files
We now detect and display a warning when we can't render the text of an opened file. Closes #5062.
This commit is contained in:
parent
3cc7b00e24
commit
dee0c46c9b
5 changed files with 35 additions and 4 deletions
|
@ -79,10 +79,11 @@ void ProjectFile::create_document_if_needed() const
|
|||
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.
|
||||
} else {
|
||||
auto& file = *file_or_error.value();
|
||||
m_document->set_text(file.read_all());
|
||||
return;
|
||||
}
|
||||
|
||||
auto& file = *file_or_error.value();
|
||||
m_could_render_text = m_document->set_text(file.read_all());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue