summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2023-02-09 03:02:46 +0100
committerLinus Groh <mail@linusgroh.de>2023-02-13 00:50:07 +0000
commit606a3982f34d777f121fcc4aa964141199676c20 (patch)
tree836fef41d11f1b77f4dac7d699e5c9f720ee4ff1 /Userland/Applications
parenta96339b72b3b417ffaa4fbb4e7575149f749acaa (diff)
downloadserenity-606a3982f34d777f121fcc4aa964141199676c20.zip
LibCore: Move Stream-based file into the `Core` namespace
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/Browser/BrowserWindow.cpp4
-rw-r--r--Userland/Applications/Browser/DownloadWidget.cpp2
-rw-r--r--Userland/Applications/Browser/DownloadWidget.h2
-rw-r--r--Userland/Applications/Browser/main.cpp4
-rw-r--r--Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp6
-rw-r--r--Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp2
-rw-r--r--Userland/Applications/FileManager/FileOperationProgressWidget.cpp2
-rw-r--r--Userland/Applications/FileManager/FileOperationProgressWidget.h5
-rw-r--r--Userland/Applications/FileManager/FileUtils.cpp4
-rw-r--r--Userland/Applications/HexEditor/HexDocument.cpp13
-rw-r--r--Userland/Applications/HexEditor/HexDocument.h14
-rw-r--r--Userland/Applications/HexEditor/HexEditor.cpp4
-rw-r--r--Userland/Applications/HexEditor/HexEditor.h4
-rw-r--r--Userland/Applications/HexEditor/HexEditorWidget.cpp8
-rw-r--r--Userland/Applications/HexEditor/HexEditorWidget.h2
-rw-r--r--Userland/Applications/HexEditor/main.cpp2
-rw-r--r--Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp3
-rw-r--r--Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp2
-rw-r--r--Userland/Applications/PDFViewer/PDFViewerWidget.cpp4
-rw-r--r--Userland/Applications/PDFViewer/PDFViewerWidget.h4
-rw-r--r--Userland/Applications/PixelPaint/ImageEditor.cpp4
-rw-r--r--Userland/Applications/PixelPaint/ImageEditor.h2
-rw-r--r--Userland/Applications/PixelPaint/MainWidget.cpp2
-rw-r--r--Userland/Applications/PixelPaint/PaletteWidget.cpp8
-rw-r--r--Userland/Applications/PixelPaint/PaletteWidget.h4
-rw-r--r--Userland/Applications/PixelPaint/ProjectLoader.cpp2
-rw-r--r--Userland/Applications/PixelPaint/ProjectLoader.h2
-rw-r--r--Userland/Applications/Presenter/Presentation.cpp3
-rw-r--r--Userland/Applications/Run/RunWindow.cpp6
-rw-r--r--Userland/Applications/SoundPlayer/M3UParser.cpp3
-rw-r--r--Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp2
-rw-r--r--Userland/Applications/Spreadsheet/ExportDialog.cpp2
-rw-r--r--Userland/Applications/Spreadsheet/ExportDialog.h2
-rw-r--r--Userland/Applications/Spreadsheet/ImportDialog.cpp2
-rw-r--r--Userland/Applications/Spreadsheet/ImportDialog.h2
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp8
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetWidget.h6
-rw-r--r--Userland/Applications/Spreadsheet/Workbook.cpp6
-rw-r--r--Userland/Applications/Spreadsheet/Workbook.h6
-rw-r--r--Userland/Applications/SystemMonitor/ProcessModel.cpp2
-rw-r--r--Userland/Applications/TextEditor/MainWidget.cpp4
-rw-r--r--Userland/Applications/TextEditor/MainWidget.h2
-rw-r--r--Userland/Applications/ThemeEditor/MainWidget.cpp12
-rw-r--r--Userland/Applications/ThemeEditor/MainWidget.h4
-rw-r--r--Userland/Applications/Welcome/WelcomeWidget.cpp4
45 files changed, 98 insertions, 93 deletions
diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp
index 46931066ea..1f73a045e9 100644
--- a/Userland/Applications/Browser/BrowserWindow.cpp
+++ b/Userland/Applications/Browser/BrowserWindow.cpp
@@ -488,7 +488,7 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
m_search_engine_actions.add_action(*m_disable_search_engine_action);
m_disable_search_engine_action->set_checked(true);
- auto search_engines_file = TRY(Core::Stream::File::open(Browser::search_engines_file_path(), Core::Stream::OpenMode::Read));
+ auto search_engines_file = TRY(Core::File::open(Browser::search_engines_file_path(), Core::File::OpenMode::Read));
auto file_size = TRY(search_engines_file->size());
auto buffer = TRY(ByteBuffer::create_uninitialized(file_size));
if (!search_engines_file->read_entire_buffer(buffer).is_error()) {
@@ -775,7 +775,7 @@ ErrorOr<void> BrowserWindow::take_screenshot(ScreenshotType type)
auto encoded = TRY(Gfx::PNGWriter::encode(*bitmap.bitmap()));
- auto screenshot_file = TRY(Core::Stream::File::open(path.string(), Core::Stream::OpenMode::Write));
+ auto screenshot_file = TRY(Core::File::open(path.string(), Core::File::OpenMode::Write));
TRY(screenshot_file->write(encoded));
return {};
diff --git a/Userland/Applications/Browser/DownloadWidget.cpp b/Userland/Applications/Browser/DownloadWidget.cpp
index db3a1fab8d..ab6023cf71 100644
--- a/Userland/Applications/Browser/DownloadWidget.cpp
+++ b/Userland/Applications/Browser/DownloadWidget.cpp
@@ -47,7 +47,7 @@ DownloadWidget::DownloadWidget(const URL& url)
};
{
- auto file_or_error = Core::Stream::File::open(m_destination_path, Core::Stream::OpenMode::Write);
+ auto file_or_error = Core::File::open(m_destination_path, Core::File::OpenMode::Write);
if (file_or_error.is_error()) {
GUI::MessageBox::show(window(), DeprecatedString::formatted("Cannot open {} for writing", m_destination_path), "Download failed"sv, GUI::MessageBox::Type::Error);
window()->close();
diff --git a/Userland/Applications/Browser/DownloadWidget.h b/Userland/Applications/Browser/DownloadWidget.h
index 176d818d87..f60fc94108 100644
--- a/Userland/Applications/Browser/DownloadWidget.h
+++ b/Userland/Applications/Browser/DownloadWidget.h
@@ -38,7 +38,7 @@ private:
RefPtr<GUI::Button> m_close_button;
RefPtr<GUI::CheckBox> m_close_on_finish_checkbox;
RefPtr<GUI::ImageWidget> m_browser_image;
- OwnPtr<Core::Stream::File> m_output_file_stream;
+ OwnPtr<Core::File> m_output_file_stream;
Core::ElapsedTimer m_elapsed_timer;
};
diff --git a/Userland/Applications/Browser/main.cpp b/Userland/Applications/Browser/main.cpp
index b094e44e0f..049be3a54b 100644
--- a/Userland/Applications/Browser/main.cpp
+++ b/Userland/Applications/Browser/main.cpp
@@ -45,8 +45,8 @@ DeprecatedString g_webdriver_content_ipc_path;
static ErrorOr<void> load_content_filters()
{
- auto file = TRY(Core::Stream::File::open(DeprecatedString::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::Stream::OpenMode::Read));
- auto ad_filter_list = TRY(Core::Stream::BufferedFile::create(move(file)));
+ auto file = TRY(Core::File::open(DeprecatedString::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::File::OpenMode::Read));
+ auto ad_filter_list = TRY(Core::BufferedFile::create(move(file)));
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));
while (TRY(ad_filter_list->can_read_line())) {
auto line = TRY(ad_filter_list->read_line(buffer));
diff --git a/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp b/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp
index da568273fa..17f44bf3a9 100644
--- a/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp
+++ b/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp
@@ -28,8 +28,8 @@ static DeprecatedString filter_list_file_path()
ErrorOr<void> DomainListModel::load()
{
// FIXME: This should be somewhat shared with Browser.
- auto file = TRY(Core::Stream::File::open(filter_list_file_path(), Core::Stream::OpenMode::Read));
- auto content_filter_list = TRY(Core::Stream::BufferedFile::create(move(file)));
+ auto file = TRY(Core::File::open(filter_list_file_path(), Core::File::OpenMode::Read));
+ auto content_filter_list = TRY(Core::BufferedFile::create(move(file)));
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));
while (TRY(content_filter_list->can_read_line())) {
auto line = TRY(content_filter_list->read_line(buffer));
@@ -50,7 +50,7 @@ ErrorOr<void> DomainListModel::save()
for (auto const& domain : m_domain_list)
TRY(builder.try_appendff("{}\n", domain));
- auto file = TRY(Core::Stream::File::open(filter_list_file_path(), Core::Stream::OpenMode::Write));
+ auto file = TRY(Core::File::open(filter_list_file_path(), Core::File::OpenMode::Write));
TRY(file->write(builder.to_byte_buffer().bytes()));
return {};
}
diff --git a/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp b/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp
index 35abe94a03..7969cd7554 100644
--- a/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp
+++ b/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp
@@ -20,7 +20,7 @@ ThemePreviewWidget::ThemePreviewWidget(Gfx::Palette const& palette)
ErrorOr<void> ThemePreviewWidget::set_theme(DeprecatedString path)
{
- auto config_file = TRY(Core::Stream::File::open(path, Core::Stream::OpenMode::Read));
+ auto config_file = TRY(Core::File::open(path, Core::File::OpenMode::Read));
TRY(set_theme_from_file(path, move(config_file)));
return {};
}
diff --git a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp
index a185c4e58e..90613a0be0 100644
--- a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp
+++ b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp
@@ -18,7 +18,7 @@
namespace FileManager {
-FileOperationProgressWidget::FileOperationProgressWidget(FileOperation operation, NonnullOwnPtr<Core::Stream::BufferedFile> helper_pipe, int helper_pipe_fd)
+FileOperationProgressWidget::FileOperationProgressWidget(FileOperation operation, NonnullOwnPtr<Core::BufferedFile> helper_pipe, int helper_pipe_fd)
: m_operation(operation)
, m_helper_pipe(move(helper_pipe))
{
diff --git a/Userland/Applications/FileManager/FileOperationProgressWidget.h b/Userland/Applications/FileManager/FileOperationProgressWidget.h
index 1fc7366f5e..907edd12f5 100644
--- a/Userland/Applications/FileManager/FileOperationProgressWidget.h
+++ b/Userland/Applications/FileManager/FileOperationProgressWidget.h
@@ -8,6 +8,7 @@
#include "FileUtils.h"
#include <LibCore/ElapsedTimer.h>
+#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibGUI/Widget.h>
@@ -21,7 +22,7 @@ public:
private:
// FIXME: The helper_pipe_fd parameter is only needed because we can't get the fd from a Core::Stream.
- FileOperationProgressWidget(FileOperation, NonnullOwnPtr<Core::Stream::BufferedFile> helper_pipe, int helper_pipe_fd);
+ FileOperationProgressWidget(FileOperation, NonnullOwnPtr<Core::BufferedFile> helper_pipe, int helper_pipe_fd);
void did_finish();
void did_error(StringView message);
@@ -34,6 +35,6 @@ private:
FileOperation m_operation;
RefPtr<Core::Notifier> m_notifier;
- OwnPtr<Core::Stream::BufferedFile> m_helper_pipe;
+ OwnPtr<Core::BufferedFile> m_helper_pipe;
};
}
diff --git a/Userland/Applications/FileManager/FileUtils.cpp b/Userland/Applications/FileManager/FileUtils.cpp
index c25b0457a8..0f5c3c423f 100644
--- a/Userland/Applications/FileManager/FileUtils.cpp
+++ b/Userland/Applications/FileManager/FileUtils.cpp
@@ -99,8 +99,8 @@ ErrorOr<void> run_file_operation(FileOperation operation, Vector<DeprecatedStrin
VERIFY_NOT_REACHED();
}
- auto pipe_input_file = TRY(Core::Stream::File::adopt_fd(pipe_fds[0], Core::Stream::OpenMode::Read));
- auto buffered_pipe = TRY(Core::Stream::BufferedFile::create(move(pipe_input_file)));
+ auto pipe_input_file = TRY(Core::File::adopt_fd(pipe_fds[0], Core::File::OpenMode::Read));
+ auto buffered_pipe = TRY(Core::BufferedFile::create(move(pipe_input_file)));
(void)TRY(window->set_main_widget<FileOperationProgressWidget>(operation, move(buffered_pipe), pipe_fds[0]));
window->resize(320, 190);
diff --git a/Userland/Applications/HexEditor/HexDocument.cpp b/Userland/Applications/HexEditor/HexDocument.cpp
index e7e49c6c19..064ca93f91 100644
--- a/Userland/Applications/HexEditor/HexDocument.cpp
+++ b/Userland/Applications/HexEditor/HexDocument.cpp
@@ -5,6 +5,7 @@
*/
#include "HexDocument.h"
+#include <LibCore/File.h>
#include <LibCore/Stream.h>
void HexDocument::set(size_t position, u8 value)
@@ -58,7 +59,7 @@ void HexDocumentMemory::clear_changes()
m_changes.clear();
}
-ErrorOr<void> HexDocumentMemory::write_to_file(Core::Stream::File& file)
+ErrorOr<void> HexDocumentMemory::write_to_file(Core::File& file)
{
TRY(file.seek(0, SeekMode::SetPosition));
TRY(file.write(m_buffer));
@@ -69,7 +70,7 @@ ErrorOr<void> HexDocumentMemory::write_to_file(Core::Stream::File& file)
return {};
}
-ErrorOr<NonnullOwnPtr<HexDocumentFile>> HexDocumentFile::create(NonnullOwnPtr<Core::Stream::File> file)
+ErrorOr<NonnullOwnPtr<HexDocumentFile>> HexDocumentFile::create(NonnullOwnPtr<Core::File> file)
{
auto document = TRY(adopt_nonnull_own_or_enomem(new HexDocumentFile(move(file))));
TRY(document->initialize_internal_state());
@@ -77,7 +78,7 @@ ErrorOr<NonnullOwnPtr<HexDocumentFile>> HexDocumentFile::create(NonnullOwnPtr<Co
return document;
}
-HexDocumentFile::HexDocumentFile(NonnullOwnPtr<Core::Stream::File> file)
+HexDocumentFile::HexDocumentFile(NonnullOwnPtr<Core::File> file)
: m_file(move(file))
{
}
@@ -94,7 +95,7 @@ ErrorOr<void> HexDocumentFile::write_to_file()
return {};
}
-ErrorOr<void> HexDocumentFile::write_to_file(Core::Stream::File& file)
+ErrorOr<void> HexDocumentFile::write_to_file(Core::File& file)
{
TRY(file.truncate(size()));
@@ -149,7 +150,7 @@ void HexDocumentFile::clear_changes()
m_changes.clear();
}
-ErrorOr<void> HexDocumentFile::set_file(NonnullOwnPtr<Core::Stream::File> file)
+ErrorOr<void> HexDocumentFile::set_file(NonnullOwnPtr<Core::File> file)
{
m_file = move(file);
TRY(initialize_internal_state());
@@ -171,7 +172,7 @@ ErrorOr<void> HexDocumentFile::initialize_internal_state()
return {};
}
-NonnullOwnPtr<Core::Stream::File> const& HexDocumentFile::file() const
+NonnullOwnPtr<Core::File> const& HexDocumentFile::file() const
{
return m_file;
}
diff --git a/Userland/Applications/HexEditor/HexDocument.h b/Userland/Applications/HexEditor/HexDocument.h
index d5e46a4f87..256f753f65 100644
--- a/Userland/Applications/HexEditor/HexDocument.h
+++ b/Userland/Applications/HexEditor/HexDocument.h
@@ -52,7 +52,7 @@ public:
size_t size() const override;
Type type() const override;
void clear_changes() override;
- ErrorOr<void> write_to_file(Core::Stream::File& file);
+ ErrorOr<void> write_to_file(Core::File& file);
private:
ByteBuffer m_buffer;
@@ -60,16 +60,16 @@ private:
class HexDocumentFile final : public HexDocument {
public:
- static ErrorOr<NonnullOwnPtr<HexDocumentFile>> create(NonnullOwnPtr<Core::Stream::File> file);
+ static ErrorOr<NonnullOwnPtr<HexDocumentFile>> create(NonnullOwnPtr<Core::File> file);
virtual ~HexDocumentFile() = default;
HexDocumentFile(HexDocumentFile&&) = default;
HexDocumentFile(HexDocumentFile const&) = delete;
- ErrorOr<void> set_file(NonnullOwnPtr<Core::Stream::File> file);
- NonnullOwnPtr<Core::Stream::File> const& file() const;
+ ErrorOr<void> set_file(NonnullOwnPtr<Core::File> file);
+ NonnullOwnPtr<Core::File> const& file() const;
ErrorOr<void> write_to_file();
- ErrorOr<void> write_to_file(Core::Stream::File& file);
+ ErrorOr<void> write_to_file(Core::File& file);
Cell get(size_t position) override;
u8 get_unchanged(size_t position) override;
size_t size() const override;
@@ -77,12 +77,12 @@ public:
void clear_changes() override;
private:
- explicit HexDocumentFile(NonnullOwnPtr<Core::Stream::File> file);
+ explicit HexDocumentFile(NonnullOwnPtr<Core::File> file);
ErrorOr<void> initialize_internal_state();
void ensure_position_in_buffer(size_t position);
- NonnullOwnPtr<Core::Stream::File> m_file;
+ NonnullOwnPtr<Core::File> m_file;
size_t m_file_size;
Array<u8, 2048> m_buffer;
diff --git a/Userland/Applications/HexEditor/HexEditor.cpp b/Userland/Applications/HexEditor/HexEditor.cpp
index e3c28811db..18922eeb76 100644
--- a/Userland/Applications/HexEditor/HexEditor.cpp
+++ b/Userland/Applications/HexEditor/HexEditor.cpp
@@ -63,7 +63,7 @@ ErrorOr<void> HexEditor::open_new_file(size_t size)
return {};
}
-void HexEditor::open_file(NonnullOwnPtr<Core::Stream::File> file)
+void HexEditor::open_file(NonnullOwnPtr<Core::File> file)
{
m_document = HexDocumentFile::create(move(file)).release_value_but_fixme_should_propagate_errors();
set_content_length(m_document->size());
@@ -136,7 +136,7 @@ void HexEditor::set_selection(size_t position, size_t length)
update_status();
}
-ErrorOr<void> HexEditor::save_as(NonnullOwnPtr<Core::Stream::File> new_file)
+ErrorOr<void> HexEditor::save_as(NonnullOwnPtr<Core::File> new_file)
{
if (m_document->type() == HexDocument::Type::File) {
auto& file_document = static_cast<HexDocumentFile&>(*m_document);
diff --git a/Userland/Applications/HexEditor/HexEditor.h b/Userland/Applications/HexEditor/HexEditor.h
index 4a27d486d5..89eeeb3b5b 100644
--- a/Userland/Applications/HexEditor/HexEditor.h
+++ b/Userland/Applications/HexEditor/HexEditor.h
@@ -35,10 +35,10 @@ public:
size_t buffer_size() const { return m_document->size(); }
ErrorOr<void> open_new_file(size_t size);
- void open_file(NonnullOwnPtr<Core::Stream::File> file);
+ void open_file(NonnullOwnPtr<Core::File> file);
ErrorOr<void> fill_selection(u8 fill_byte);
Optional<u8> get_byte(size_t position);
- ErrorOr<void> save_as(NonnullOwnPtr<Core::Stream::File>);
+ ErrorOr<void> save_as(NonnullOwnPtr<Core::File>);
ErrorOr<void> save();
bool undo();
diff --git a/Userland/Applications/HexEditor/HexEditorWidget.cpp b/Userland/Applications/HexEditor/HexEditorWidget.cpp
index 64a43c3e3e..9084e049b9 100644
--- a/Userland/Applications/HexEditor/HexEditorWidget.cpp
+++ b/Userland/Applications/HexEditor/HexEditorWidget.cpp
@@ -121,7 +121,7 @@ HexEditorWidget::HexEditorWidget()
if (!request_close())
return;
- auto response = FileSystemAccessClient::Client::the().open_file(window(), {}, Core::StandardPaths::home_directory(), Core::Stream::OpenMode::ReadWrite);
+ auto response = FileSystemAccessClient::Client::the().open_file(window(), {}, Core::StandardPaths::home_directory(), Core::File::OpenMode::ReadWrite);
if (response.is_error())
return;
@@ -142,7 +142,7 @@ HexEditorWidget::HexEditorWidget()
});
m_save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) {
- auto response = FileSystemAccessClient::Client::the().save_file(window(), m_name, m_extension, Core::Stream::OpenMode::ReadWrite | Core::Stream::OpenMode::Truncate);
+ auto response = FileSystemAccessClient::Client::the().save_file(window(), m_name, m_extension, Core::File::OpenMode::ReadWrite | Core::File::OpenMode::Truncate);
if (response.is_error())
return;
auto file = response.release_value();
@@ -525,7 +525,7 @@ void HexEditorWidget::update_title()
window()->set_title(builder.to_deprecated_string());
}
-void HexEditorWidget::open_file(String const& filename, NonnullOwnPtr<Core::Stream::File> file)
+void HexEditorWidget::open_file(String const& filename, NonnullOwnPtr<Core::File> file)
{
window()->set_modified(false);
m_editor->open_file(move(file));
@@ -586,7 +586,7 @@ void HexEditorWidget::drop_event(GUI::DropEvent& event)
return;
// TODO: A drop event should be considered user consent for opening a file
- auto response = FileSystemAccessClient::Client::the().request_file(window(), urls.first().path(), Core::Stream::OpenMode::Read);
+ auto response = FileSystemAccessClient::Client::the().request_file(window(), urls.first().path(), Core::File::OpenMode::Read);
if (response.is_error())
return;
open_file(response.value().filename(), response.value().release_stream());
diff --git a/Userland/Applications/HexEditor/HexEditorWidget.h b/Userland/Applications/HexEditor/HexEditorWidget.h
index addddd246f..a919de7f36 100644
--- a/Userland/Applications/HexEditor/HexEditorWidget.h
+++ b/Userland/Applications/HexEditor/HexEditorWidget.h
@@ -25,7 +25,7 @@ class HexEditorWidget final : public GUI::Widget {
C_OBJECT(HexEditorWidget)
public:
virtual ~HexEditorWidget() override = default;
- void open_file(String const& filename, NonnullOwnPtr<Core::Stream::File>);
+ void open_file(String const& filename, NonnullOwnPtr<Core::File>);
void initialize_menubar(GUI::Window&);
bool request_close();
diff --git a/Userland/Applications/HexEditor/main.cpp b/Userland/Applications/HexEditor/main.cpp
index f3311bc0e6..185653455b 100644
--- a/Userland/Applications/HexEditor/main.cpp
+++ b/Userland/Applications/HexEditor/main.cpp
@@ -53,7 +53,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (arguments.argc > 1) {
// FIXME: Using `try_request_file_read_only_approved` doesn't work here since the file stored in the editor is only readable.
- auto response = FileSystemAccessClient::Client::the().request_file(window, arguments.strings[1], Core::Stream::OpenMode::ReadWrite);
+ auto response = FileSystemAccessClient::Client::the().request_file(window, arguments.strings[1], Core::File::OpenMode::ReadWrite);
if (response.is_error())
return 1;
hex_editor_widget->open_file(response.value().filename(), response.value().release_stream());
diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp
index a602dbaf10..678fd1a573 100644
--- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp
+++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp
@@ -8,6 +8,7 @@
#include "KeyboardMapperWidget.h"
#include "KeyPositions.h"
+#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/InputBox.h>
@@ -191,7 +192,7 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename)
// Write to file.
DeprecatedString file_content = map_json.to_deprecated_string();
- auto file = TRY(Core::Stream::File::open(filename, Core::Stream::OpenMode::Write));
+ auto file = TRY(Core::File::open(filename, Core::File::OpenMode::Write));
TRY(file->write(file_content.bytes()));
file->close();
diff --git a/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp b/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp
index a57685df36..e8698e2d06 100644
--- a/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp
+++ b/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp
@@ -62,7 +62,7 @@ NetworkSettingsWidget::NetworkSettingsWidget()
auto config_file = Core::ConfigFile::open_for_system("Network").release_value_but_fixme_should_propagate_errors();
- auto proc_net_adapters_file = Core::Stream::File::open("/sys/kernel/net/adapters"sv, Core::Stream::OpenMode::Read).release_value_but_fixme_should_propagate_errors();
+ auto proc_net_adapters_file = Core::File::open("/sys/kernel/net/adapters"sv, Core::File::OpenMode::Read).release_value_but_fixme_should_propagate_errors();
auto data = proc_net_adapters_file->read_until_eof().release_value_but_fixme_should_propagate_errors();
JsonParser parser(data);
JsonValue proc_net_adapters_json = parser.parse().release_value_but_fixme_should_propagate_errors();
diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
index b98629302e..3d0210dee4 100644
--- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
+++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
@@ -348,7 +348,7 @@ void PDFViewerWidget::initialize_toolbar(GUI::Toolbar& toolbar)
m_show_images->on_checked = [&](auto checked) { m_viewer->set_show_images(checked); };
}
-void PDFViewerWidget::open_file(StringView path, NonnullOwnPtr<Core::Stream::File> file)
+void PDFViewerWidget::open_file(StringView path, NonnullOwnPtr<Core::File> file)
{
auto maybe_error = try_open_file(path, move(file));
if (maybe_error.is_error()) {
@@ -359,7 +359,7 @@ void PDFViewerWidget::open_file(StringView path, NonnullOwnPtr<Core::Stream::Fil
}
}
-PDF::PDFErrorOr<void> PDFViewerWidget::try_open_file(StringView path, NonnullOwnPtr<Core::Stream::File> file)
+PDF::PDFErrorOr<void> PDFViewerWidget::try_open_file(StringView path, NonnullOwnPtr<Core::File> file)
{
window()->set_title(DeprecatedString::formatted("{} - PDF Viewer", path));
diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.h b/Userland/Applications/PDFViewer/PDFViewerWidget.h
index cd1171f259..822d55da88 100644
--- a/Userland/Applications/PDFViewer/PDFViewerWidget.h
+++ b/Userland/Applications/PDFViewer/PDFViewerWidget.h
@@ -26,13 +26,13 @@ public:
~PDFViewerWidget() override = default;
void initialize_menubar(GUI::Window&);
- void open_file(StringView path, NonnullOwnPtr<Core::Stream::File> file);
+ void open_file(StringView path, NonnullOwnPtr<Core::File> file);
private:
PDFViewerWidget();
void initialize_toolbar(GUI::Toolbar&);
- PDF::PDFErrorOr<void> try_open_file(StringView path, NonnullOwnPtr<Core::Stream::File> file);
+ PDF::PDFErrorOr<void> try_open_file(StringView path, NonnullOwnPtr<Core::File> file);
RefPtr<PDFViewer> m_viewer;
RefPtr<SidebarWidget> m_sidebar;
diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp
index 0e058e8515..0d7ce8f339 100644
--- a/Userland/Applications/PixelPaint/ImageEditor.cpp
+++ b/Userland/Applications/PixelPaint/ImageEditor.cpp
@@ -733,7 +733,7 @@ void ImageEditor::save_project()
save_project_as();
return;
}
- auto response = FileSystemAccessClient::Client::the().request_file(window(), path(), Core::Stream::OpenMode::Truncate | Core::Stream::OpenMode::Write);
+ auto response = FileSystemAccessClient::Client::the().request_file(window(), path(), Core::File::OpenMode::Truncate | Core::File::OpenMode::Write);
if (response.is_error())
return;
auto result = save_project_to_file(response.value().release_stream());
@@ -760,7 +760,7 @@ void ImageEditor::save_project_as()
set_unmodified();
}
-ErrorOr<void> ImageEditor::save_project_to_file(NonnullOwnPtr<Core::Stream::File> file) const
+ErrorOr<void> ImageEditor::save_project_to_file(NonnullOwnPtr<Core::File> file) const
{
StringBuilder builder;
auto json = TRY(JsonObjectSerializer<>::try_create(builder));
diff --git a/Userland/Applications/PixelPaint/ImageEditor.h b/Userland/Applications/PixelPaint/ImageEditor.h
index 727868247f..9142ca67ee 100644
--- a/Userland/Applications/PixelPaint/ImageEditor.h
+++ b/Userland/Applications/PixelPaint/ImageEditor.h
@@ -153,7 +153,7 @@ private:
GUI::MouseEvent event_adjusted_for_layer(GUI::MouseEvent const&, Layer const&) const;
GUI::MouseEvent event_with_pan_and_scale_applied(GUI::MouseEvent const&) const;
- ErrorOr<void> save_project_to_file(NonnullOwnPtr<Core::Stream::File>) const;
+ ErrorOr<void> save_project_to_file(NonnullOwnPtr<Core::File>) const;
int calculate_ruler_step_size() const;
Gfx::IntRect mouse_indicator_rect_x() const;
diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp
index 8138870e98..f54f99f264 100644
--- a/Userland/Applications/PixelPaint/MainWidget.cpp
+++ b/Userland/Applications/PixelPaint/MainWidget.cpp
@@ -1288,7 +1288,7 @@ void MainWidget::drop_event(GUI::DropEvent& event)
if (url.scheme() != "file")
continue;
- auto response = FileSystemAccessClient::Client::the().request_file(window(), url.path(), Core::Stream::OpenMode::Read);
+ auto response = FileSystemAccessClient::Client::the().request_file(window(), url.path(), Core::File::OpenMode::Read);
if (response.is_error())
return;
open_image(response.release_value());
diff --git a/Userland/Applications/PixelPaint/PaletteWidget.cpp b/Userland/Applications/PixelPaint/PaletteWidget.cpp
index 96fb38965a..aab595cb64 100644
--- a/Userland/Applications/PixelPaint/PaletteWidget.cpp
+++ b/Userland/Applications/PixelPaint/PaletteWidget.cpp
@@ -224,11 +224,11 @@ Vector<Color> PaletteWidget::colors()
return colors;
}
-ErrorOr<Vector<Color>> PaletteWidget::load_palette_file(NonnullOwnPtr<Core::Stream::File> file)
+ErrorOr<Vector<Color>> PaletteWidget::load_palette_file(NonnullOwnPtr<Core::File> file)
{
Vector<Color> palette;
Array<u8, PAGE_SIZE> buffer;
- auto buffered_file = TRY(Core::Stream::BufferedFile::create(move(file)));
+ auto buffered_file = TRY(Core::BufferedFile::create(move(file)));
while (TRY(buffered_file->can_read_line())) {
auto line = TRY(buffered_file->read_line(buffer));
@@ -252,11 +252,11 @@ ErrorOr<Vector<Color>> PaletteWidget::load_palette_file(NonnullOwnPtr<Core::Stre
ErrorOr<Vector<Color>> PaletteWidget::load_palette_path(DeprecatedString const& file_path)
{
- auto file = TRY(Core::Stream::File::open(file_path, Core::Stream::OpenMode::Read));
+ auto file = TRY(Core::File::open(file_path, Core::File::OpenMode::Read));
return load_palette_file(move(file));
}
-ErrorOr<void> PaletteWidget::save_palette_file(Vector<Color> palette, NonnullOwnPtr<Core::Stream::File> file)
+ErrorOr<void> PaletteWidget::save_palette_file(Vector<Color> palette, NonnullOwnPtr<Core::File> file)
{
for (auto& color : palette) {
TRY(file->write_entire_buffer(color.to_deprecated_string_without_alpha().bytes()));
diff --git a/Userland/Applications/PixelPaint/PaletteWidget.h b/Userland/Applications/PixelPaint/PaletteWidget.h
index aedfce3438..362c29f518 100644
--- a/Userland/Applications/PixelPaint/PaletteWidget.h
+++ b/Userland/Applications/PixelPaint/PaletteWidget.h
@@ -31,9 +31,9 @@ public:
Vector<Color> colors();
- static ErrorOr<Vector<Color>> load_palette_file(NonnullOwnPtr<Core::Stream::File>);
+ static ErrorOr<Vector<Color>> load_palette_file(NonnullOwnPtr<Core::File>);
static ErrorOr<Vector<Color>> load_palette_path(DeprecatedString const&);
- static ErrorOr<void> save_palette_file(Vector<Color>, NonnullOwnPtr<Core::Stream::File>);
+ static ErrorOr<void> save_palette_file(Vector<Color>, NonnullOwnPtr<Core::File>);
static Vector<Color> fallback_colors();
diff --git a/Userland/Applications/PixelPaint/ProjectLoader.cpp b/Userland/Applications/PixelPaint/ProjectLoader.cpp
index 020beb5423..c5ff761986 100644
--- a/Userland/Applications/PixelPaint/ProjectLoader.cpp
+++ b/Userland/Applications/PixelPaint/ProjectLoader.cpp
@@ -15,7 +15,7 @@
namespace PixelPaint {
-ErrorOr<void> ProjectLoader::load_from_file(NonnullOwnPtr<Core::Stream::File> file)
+ErrorOr<void> ProjectLoader::load_from_file(NonnullOwnPtr<Core::File> file)
{
auto contents = TRY(file->read_until_eof());
diff --git a/Userland/Applications/PixelPaint/ProjectLoader.h b/Userland/Applications/PixelPaint/ProjectLoader.h
index d16c7fef1a..111964e11c 100644
--- a/Userland/Applications/PixelPaint/ProjectLoader.h
+++ b/Userland/Applications/PixelPaint/ProjectLoader.h
@@ -18,7 +18,7 @@ public:
ProjectLoader() = default;
~ProjectLoader() = default;
- ErrorOr<void> load_from_file(NonnullOwnPtr<Core::Stream::File>);
+ ErrorOr<void> load_from_file(NonnullOwnPtr<Core::File>);
bool is_raw_image() const { return m_is_raw_image; }
bool has_image() const { return !m_image.is_null(); }
diff --git a/Userland/Applications/Presenter/Presentation.cpp b/Userland/Applications/Presenter/Presentation.cpp
index 2959022f10..a90da1e9db 100644
--- a/Userland/Applications/Presenter/Presentation.cpp
+++ b/Userland/Applications/Presenter/Presentation.cpp
@@ -7,6 +7,7 @@
#include "Presentation.h"
#include <AK/JsonObject.h>
+#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibGUI/Window.h>
#include <errno_codes.h>
@@ -79,7 +80,7 @@ ErrorOr<NonnullOwnPtr<Presentation>> Presentation::load_from_file(StringView fil
{
if (file_name.is_empty())
return ENOENT;
- auto file = TRY(Core::Stream::File::open_file_or_standard_stream(file_name, Core::Stream::OpenMode::Read));
+ auto file = TRY(Core::File::open_file_or_standard_stream(file_name, Core::File::OpenMode::Read));
auto contents = TRY(file->read_until_eof());
auto content_string = StringView { contents };
auto json = TRY(JsonValue::from_string(content_string));
diff --git a/Userland/Applications/Run/RunWindow.cpp b/Userland/Applications/Run/RunWindow.cpp
index 4c86e9df8e..fc82de3cd6 100644
--- a/Userland/Applications/Run/RunWindow.cpp
+++ b/Userland/Applications/Run/RunWindow.cpp
@@ -170,8 +170,8 @@ DeprecatedString RunWindow::history_file_path()
ErrorOr<void> RunWindow::load_history()
{
m_path_history.clear();
- auto file = TRY(Core::Stream::File::open(history_file_path(), Core::Stream::OpenMode::Read));
- auto buffered_file = TRY(Core::Stream::BufferedFile::create(move(file)));
+ auto file = TRY(Core::File::open(history_file_path(), Core::File::OpenMode::Read));
+ auto buffered_file = TRY(Core::BufferedFile::create(move(file)));
Array<u8, PAGE_SIZE> line_buffer;
while (!buffered_file->is_eof()) {
@@ -184,7 +184,7 @@ ErrorOr<void> RunWindow::load_history()
ErrorOr<void> RunWindow::save_history()
{
- auto file = TRY(Core::Stream::File::open(history_file_path(), Core::Stream::OpenMode::Write));
+ auto file = TRY(Core::File::open(history_file_path(), Core::File::OpenMode::Write));
// Write the first 25 items of history
for (int i = 0; i < min(static_cast<int>(m_path_history.size()), 25); i++)
diff --git a/Userland/Applications/SoundPlayer/M3UParser.cpp b/Userland/Applications/SoundPlayer/M3UParser.cpp
index 5cd76a45cc..43353b202b 100644
--- a/Userland/Applications/SoundPlayer/M3UParser.cpp
+++ b/Userland/Applications/SoundPlayer/M3UParser.cpp
@@ -9,6 +9,7 @@
#include <AK/RefPtr.h>
#include <AK/ScopeGuard.h>
#include <AK/Utf8View.h>
+#include <LibCore/File.h>
#include <LibCore/Stream.h>
M3UParser::M3UParser()
@@ -17,7 +18,7 @@ M3UParser::M3UParser()
NonnullOwnPtr<M3UParser> M3UParser::from_file(StringView path)
{
- auto file_result = Core::Stream::File::open(path, Core::Stream::OpenMode::Read).release_value_but_fixme_should_propagate_errors();
+ auto file_result = Core::File::open(path, Core::File::OpenMode::Read).release_value_but_fixme_should_propagate_errors();
auto contents = file_result->read_until_eof().release_value_but_fixme_should_propagate_errors();
auto use_utf8 = path.ends_with(".m3u8"sv, CaseSensitivity::CaseInsensitive);
return from_memory(DeprecatedString { contents, NoChomp }, use_utf8);
diff --git a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp
index 052bdae088..bd4f6927ef 100644
--- a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp
+++ b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp
@@ -375,7 +375,7 @@ void TreeMapWidget::recalculate_path_for_new_tree()
static ErrorOr<void> fill_mounts(Vector<MountInfo>& output)
{
// Output info about currently mounted filesystems.
- auto file = TRY(Core::Stream::File::open("/sys/kernel/df"sv, Core::Stream::OpenMode::Read));
+ auto file = TRY(Core::File::open("/sys/kernel/df"sv, Core::File::OpenMode::Read));
auto content = TRY(file->read_until_eof());
auto json = TRY(JsonValue::from_string(content));
diff --git a/Userland/Applications/Spreadsheet/ExportDialog.cpp b/Userland/Applications/Spreadsheet/ExportDialog.cpp
index df225e4888..35b1ca676f 100644
--- a/Userland/Applications/Spreadsheet/ExportDialog.cpp
+++ b/Userland/Applications/Spreadsheet/ExportDialog.cpp
@@ -178,7 +178,7 @@ void CSVExportDialogPage::update_preview()
m_data_preview_text_editor->set_text(DeprecatedString::formatted("Cannot update preview: {}", maybe_error.error()));
}
-ErrorOr<void> ExportDialog::make_and_run_for(StringView mime, Core::Stream::File& file, DeprecatedString filename, Workbook& workbook)
+ErrorOr<void> ExportDialog::make_and_run_for(StringView mime, Core::File& file, DeprecatedString filename, Workbook& workbook)
{
auto wizard = GUI::WizardDialog::construct(GUI::Application::the()->active_window());
wizard->set_title("File Export Wizard");
diff --git a/Userland/Applications/Spreadsheet/ExportDialog.h b/Userland/Applications/Spreadsheet/ExportDialog.h
index 3579e135aa..c3e5fab677 100644
--- a/Userland/Applications/Spreadsheet/ExportDialog.h
+++ b/Userland/Applications/Spreadsheet/ExportDialog.h
@@ -58,7 +58,7 @@ private:
};
struct ExportDialog {
- static ErrorOr<void> make_and_run_for(StringView mime, Core::Stream::File&, DeprecatedString filename, Workbook&);
+ static ErrorOr<void> make_and_run_for(StringView mime, Core::File&, DeprecatedString filename, Workbook&);
};
}
diff --git a/Userland/Applications/Spreadsheet/ImportDialog.cpp b/Userland/Applications/Spreadsheet/ImportDialog.cpp
index f27cfdf8b2..2da65ae87d 100644
--- a/Userland/Applications/Spreadsheet/ImportDialog.cpp
+++ b/Userland/Applications/Spreadsheet/ImportDialog.cpp
@@ -174,7 +174,7 @@ void CSVImportDialogPage::update_preview()
m_data_preview_table_view->update();
}
-ErrorOr<NonnullRefPtrVector<Sheet>, DeprecatedString> ImportDialog::make_and_run_for(GUI::Window& parent, StringView mime, String const& filename, Core::Stream::File& file, Workbook& workbook)
+ErrorOr<NonnullRefPtrVector<Sheet>, DeprecatedString> ImportDialog::make_and_run_for(GUI::Window& parent, StringView mime, String const& filename, Core::File& file, Workbook& workbook)
{
auto wizard = GUI::WizardDialog::construct(&parent);
wizard->set_title("File Import Wizard");
diff --git a/Userland/Applications/Spreadsheet/ImportDialog.h b/Userland/Applications/Spreadsheet/ImportDialog.h
index 7e8b5b00f3..dba25312c6 100644
--- a/Userland/Applications/Spreadsheet/ImportDialog.h
+++ b/Userland/Applications/Spreadsheet/ImportDialog.h
@@ -55,7 +55,7 @@ private:
};
struct ImportDialog {
- static ErrorOr<NonnullRefPtrVector<Sheet>, DeprecatedString> make_and_run_for(GUI::Window& parent, StringView mime, String const& filename, Core::Stream::File& file, Workbook&);
+ static ErrorOr<NonnullRefPtrVector<Sheet>, DeprecatedString> make_and_run_for(GUI::Window& parent, StringView mime, String const& filename, Core::File& file, Workbook&);
};
}
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp
index d297186662..5d8fcc72fa 100644
--- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp
+++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp
@@ -147,7 +147,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe
return;
}
- auto response = FileSystemAccessClient::Client::the().request_file(window(), current_filename(), Core::Stream::OpenMode::Write);
+ auto response = FileSystemAccessClient::Client::the().request_file(window(), current_filename(), Core::File::OpenMode::Write);
if (response.is_error())
return;
save(response.value().filename(), response.value().stream());
@@ -493,7 +493,7 @@ void SpreadsheetWidget::change_cell_static_color_format(Spreadsheet::FormatType
}
}
-void SpreadsheetWidget::save(String const& filename, Core::Stream::File& file)
+void SpreadsheetWidget::save(String const& filename, Core::File& file)
{
auto result = m_workbook->write_to_file(filename, file);
if (result.is_error()) {
@@ -504,7 +504,7 @@ void SpreadsheetWidget::save(String const& filename, Core::Stream::File& file)
window()->set_modified(false);
}
-void SpreadsheetWidget::load_file(String const& filename, Core::Stream::File& file)
+void SpreadsheetWidget::load_file(String const& filename, Core::File& file)
{
auto result = m_workbook->open_file(filename, file);
if (result.is_error()) {
@@ -523,7 +523,7 @@ void SpreadsheetWidget::load_file(String const& filename, Core::Stream::File& fi
update_window_title();
}
-void SpreadsheetWidget::import_sheets(String const& filename, Core::Stream::File& file)
+void SpreadsheetWidget::import_sheets(String const& filename, Core::File& file)
{
auto result = m_workbook->import_file(filename, file);
if (result.is_error()) {
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.h b/Userland/Applications/Spreadsheet/SpreadsheetWidget.h
index 63fe723b89..31d21c7f5c 100644
--- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.h
+++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.h
@@ -24,9 +24,9 @@ class SpreadsheetWidget final
public:
virtual ~SpreadsheetWidget() override = default;
- void save(String const& filename, Core::Stream::File&);
- void load_file(String const& filename, Core::Stream::File&);
- void import_sheets(String const& filename, Core::Stream::File&);
+ void save(String const& filename, Core::File&);
+ void load_file(String const& filename, Core::File&);
+ void import_sheets(String const& filename, Core::File&);
bool request_close();
void add_sheet();
void add_sheet(NonnullRefPtr<Sheet>&&);
diff --git a/Userland/Applications/Spreadsheet/Workbook.cpp b/Userland/Applications/Spreadsheet/Workbook.cpp
index 16c0ba407c..3df8daa501 100644
--- a/Userland/Applications/Spreadsheet/Workbook.cpp
+++ b/Userland/Applications/Spreadsheet/Workbook.cpp
@@ -50,7 +50,7 @@ bool Workbook::set_filename(DeprecatedString const& filename)
return true;
}
-ErrorOr<void, DeprecatedString> Workbook::open_file(String const& filename, Core::Stream::File& file)
+ErrorOr<void, DeprecatedString> Workbook::open_file(String const& filename, Core::File& file)
{
auto mime = Core::guess_mime_type_based_on_filename(filename);
@@ -62,7 +62,7 @@ ErrorOr<void, DeprecatedString> Workbook::open_file(String const& filename, Core
return {};
}
-ErrorOr<void> Workbook::write_to_file(String const& filename, Core::Stream::File& stream)
+ErrorOr<void> Workbook::write_to_file(String const& filename, Core::File& stream)
{
auto mime = Core::guess_mime_type_based_on_filename(filename);
@@ -74,7 +74,7 @@ ErrorOr<void> Workbook::write_to_file(String const& filename, Core::Stream::File
return {};
}
-ErrorOr<bool, DeprecatedString> Workbook::import_file(String const& filename, Core::Stream::File& file)
+ErrorOr<bool, DeprecatedString> Workbook::import_file(String const& filename, Core::File& file)
{
auto mime = Core::guess_mime_type_based_on_filename(filename);
diff --git a/Userland/Applications/Spreadsheet/Workbook.h b/Userland/Applications/Spreadsheet/Workbook.h
index 2020a23943..84d394053d 100644
--- a/Userland/Applications/Spreadsheet/Workbook.h
+++ b/Userland/Applications/Spreadsheet/Workbook.h
@@ -16,10 +16,10 @@ class Workbook {
public:
Workbook(NonnullRefPtrVector<Sheet>&& sheets, GUI::Window& parent_window);
- ErrorOr<void, DeprecatedString> open_file(String const& filename, Core::Stream::File&);
- ErrorOr<void> write_to_file(String const& filename, Core::Stream::File&);
+ ErrorOr<void, DeprecatedString> open_file(String const& filename, Core::File&);
+ ErrorOr<void> write_to_file(String const& filename, Core::File&);
- ErrorOr<bool, DeprecatedString> import_file(String const& filename, Core::Stream::File&);
+ ErrorOr<bool, DeprecatedString> import_file(String const& filename, Core::File&);
DeprecatedString const& current_filename() const { return m_current_filename; }
bool set_filename(DeprecatedString const& filename);
diff --git a/Userland/Applications/SystemMonitor/ProcessModel.cpp b/Userland/Applications/SystemMonitor/ProcessModel.cpp
index f32d84ad25..04d031269c 100644
--- a/Userland/Applications/SystemMonitor/ProcessModel.cpp
+++ b/Userland/Applications/SystemMonitor/ProcessModel.cpp
@@ -410,7 +410,7 @@ Vector<GUI::ModelIndex> ProcessModel::matches(StringView searching, unsigned fla
static ErrorOr<DeprecatedString> try_read_command_line(pid_t pid)
{
- auto file = TRY(Core::Stream::File::open(DeprecatedString::formatted("/proc/{}/cmdline", pid), Core::Stream::OpenMode::Read));
+ auto file = TRY(Core::File::open(DeprecatedString::formatted("/proc/{}/cmdline", pid), Core::File::OpenMode::Read));
auto data = TRY(file->read_until_eof());
auto json = TRY(JsonValue::from_string(StringView { data.bytes() }));
auto array = json.as_array().values();
diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp
index 99a42a3178..a95a47bad6 100644
--- a/Userland/Applications/TextEditor/MainWidget.cpp
+++ b/Userland/Applications/TextEditor/MainWidget.cpp
@@ -303,7 +303,7 @@ MainWidget::MainWidget()
m_save_as_action->activate();
return;
}
- auto response = FileSystemAccessClient::Client::the().request_file(window(), m_path, Core::Stream::OpenMode::Truncate | Core::Stream::OpenMode::Write);
+ auto response = FileSystemAccessClient::Client::the().request_file(window(), m_path, Core::File::OpenMode::Truncate | Core::File::OpenMode::Write);
if (response.is_error())
return;
@@ -746,7 +746,7 @@ void MainWidget::update_title()
window()->set_title(builder.to_deprecated_string());
}
-ErrorOr<void> MainWidget::read_file(String const& filename, Core::Stream::File& file)
+ErrorOr<void> MainWidget::read_file(String const& filename, Core::File& file)
{
m_editor->set_text(TRY(file.read_until_eof()));
set_path(filename);
diff --git a/Userland/Applications/TextEditor/MainWidget.h b/Userland/Applications/TextEditor/MainWidget.h
index 04ff814e22..61c37fefe6 100644
--- a/Userland/Applications/TextEditor/MainWidget.h
+++ b/Userland/Applications/TextEditor/MainWidget.h
@@ -25,7 +25,7 @@ class MainWidget final : public GUI::Widget {
public:
virtual ~MainWidget() override = default;
- ErrorOr<void> read_file(String const& filename, Core::Stream::File&);
+ ErrorOr<void> read_file(String const& filename, Core::File&);
void open_nonexistent_file(DeprecatedString const& path);
bool request_close();
diff --git a/Userland/Applications/ThemeEditor/MainWidget.cpp b/Userland/Applications/ThemeEditor/MainWidget.cpp
index ff4e6453dd..b80dcb5ffe 100644
--- a/Userland/Applications/ThemeEditor/MainWidget.cpp
+++ b/Userland/Applications/ThemeEditor/MainWidget.cpp
@@ -250,12 +250,12 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
m_save_action = GUI::CommonActions::make_save_action([&](auto&) {
if (m_path.has_value()) {
- auto result = FileSystemAccessClient::Client::the().request_file(&window, *m_path, Core::Stream::OpenMode::ReadWrite | Core::Stream::OpenMode::Truncate);
+ auto result = FileSystemAccessClient::Client::the().request_file(&window, *m_path, Core::File::OpenMode::ReadWrite | Core::File::OpenMode::Truncate);
if (result.is_error())
return;
save_to_file(result.value().filename(), result.value().release_stream());
} else {
- auto result = FileSystemAccessClient::Client::the().save_file(&window, "Theme", "ini", Core::Stream::OpenMode::ReadWrite | Core::Stream::OpenMode::Truncate);
+ auto result = FileSystemAccessClient::Client::the().save_file(&window, "Theme", "ini", Core::File::OpenMode::ReadWrite | Core::File::OpenMode::Truncate);
if (result.is_error())
return;
save_to_file(result.value().filename(), result.value().release_stream());
@@ -264,7 +264,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
TRY(file_menu->try_add_action(*m_save_action));
TRY(file_menu->try_add_action(GUI::CommonActions::make_save_as_action([&](auto&) {
- auto result = FileSystemAccessClient::Client::the().save_file(&window, "Theme", "ini", Core::Stream::OpenMode::ReadWrite | Core::Stream::OpenMode::Truncate);
+ auto result = FileSystemAccessClient::Client::the().save_file(&window, "Theme", "ini", Core::File::OpenMode::ReadWrite | Core::File::OpenMode::Truncate);
if (result.is_error())
return;
save_to_file(result.value().filename(), result.value().release_stream());
@@ -315,7 +315,7 @@ void MainWidget::set_path(DeprecatedString path)
update_title();
}
-void MainWidget::save_to_file(String const& filename, NonnullOwnPtr<Core::Stream::File> file)
+void MainWidget::save_to_file(String const& filename, NonnullOwnPtr<Core::File> file)
{
auto theme = Core::ConfigFile::open(filename.to_deprecated_string(), move(file)).release_value_but_fixme_should_propagate_errors();
@@ -601,7 +601,7 @@ void MainWidget::show_path_picker_dialog(StringView property_display_name, GUI::
path_input.set_text(*result);
}
-ErrorOr<void> MainWidget::load_from_file(String const& filename, NonnullOwnPtr<Core::Stream::File> file)
+ErrorOr<void> MainWidget::load_from_file(String const& filename, NonnullOwnPtr<Core::File> file)
{
auto config_file = TRY(Core::ConfigFile::open(filename.to_deprecated_string(), move(file)));
auto theme = TRY(Gfx::load_system_theme(config_file));
@@ -669,7 +669,7 @@ void MainWidget::drop_event(GUI::DropEvent& event)
if (request_close() == GUI::Window::CloseRequestDecision::StayOpen)
return;
- auto response = FileSystemAccessClient::Client::the().request_file(window(), urls.first().path(), Core::Stream::OpenMode::Read);
+ auto response = FileSystemAccessClient::Client::the().request_file(window(), urls.first().path(), Core::File::OpenMode::Read);
if (response.is_error())
return;
diff --git a/Userland/Applications/ThemeEditor/MainWidget.h b/Userland/Applications/ThemeEditor/MainWidget.h
index d33155de80..287a165b04 100644
--- a/Userland/Applications/ThemeEditor/MainWidget.h
+++ b/Userland/Applications/ThemeEditor/MainWidget.h
@@ -86,7 +86,7 @@ public:
ErrorOr<void> initialize_menubar(GUI::Window&);
GUI::Window::CloseRequestDecision request_close();
void update_title();
- ErrorOr<void> load_from_file(String const& filename, NonnullOwnPtr<Core::Stream::File> file);
+ ErrorOr<void> load_from_file(String const& filename, NonnullOwnPtr<Core::File> file);
private:
explicit MainWidget(NonnullRefPtr<AlignmentModel>);
@@ -94,7 +94,7 @@ private:
virtual void drag_enter_event(GUI::DragEvent&) override;
virtual void drop_event(GUI::DropEvent&) override;
- void save_to_file(String const& filename, NonnullOwnPtr<Core::Stream::File> file);
+ void save_to_file(String const& filename, NonnullOwnPtr<Core::File> file);
ErrorOr<Core::AnonymousBuffer> encode();
void set_path(DeprecatedString);
diff --git a/Userland/Applications/Welcome/WelcomeWidget.cpp b/Userland/Applications/Welcome/WelcomeWidget.cpp
index 4fef76b034..776c37f84b 100644
--- a/Userland/Applications/Welcome/WelcomeWidget.cpp
+++ b/Userland/Applications/Welcome/WelcomeWidget.cpp
@@ -95,8 +95,8 @@ ErrorOr<void> WelcomeWidget::create_widgets()
ErrorOr<void> WelcomeWidget::open_and_parse_tips_file()
{
auto path = TRY(String::formatted("{}/tips.txt", Core::StandardPaths::documents_directory()));
- auto file = TRY(Core::Stream::File::open(path, Core::Stream::OpenMode::Read));
- auto buffered_file = TRY(Core::Stream::BufferedFile::create(move(file)));
+ auto file = TRY(Core::File::open(path, Core::File::OpenMode::Read));
+ auto buffered_file = TRY(Core::BufferedFile::create(move(file)));
Array<u8, PAGE_SIZE> buffer;
while (TRY(buffered_file->can_read_line())) {