mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:38:11 +00:00
HackStudio: Port to Core::Stream::File
:^)
This commit is contained in:
parent
697d6ffb1d
commit
4784ad66b2
8 changed files with 72 additions and 66 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "../Dialogs/Git/GitCommitDialog.h"
|
||||
#include "GitFilesModel.h"
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibDiff/Format.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
|
@ -156,15 +157,9 @@ void GitWidget::set_view_diff_callback(ViewDiffCallback callback)
|
|||
void GitWidget::show_diff(DeprecatedString const& file_path)
|
||||
{
|
||||
if (!m_git_repo->is_tracked(file_path)) {
|
||||
auto file = Core::File::construct(file_path);
|
||||
if (!file->open(Core::OpenMode::ReadOnly)) {
|
||||
perror("open");
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
auto content = file->read_all();
|
||||
DeprecatedString content_string((char*)content.data(), content.size());
|
||||
m_view_diff_callback("", Diff::generate_only_additions(content_string));
|
||||
auto file = Core::Stream::File::open(file_path, Core::Stream::OpenMode::Read).release_value_but_fixme_should_propagate_errors();
|
||||
auto content = file->read_until_eof().release_value_but_fixme_should_propagate_errors();
|
||||
m_view_diff_callback("", Diff::generate_only_additions(content));
|
||||
return;
|
||||
}
|
||||
auto const& original_content = m_git_repo->original_file_content(file_path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue