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

LibCore: Rename File to DeprecatedFile

As usual, this removes many unused includes and moves used includes
further down the chain.
This commit is contained in:
Tim Schumacher 2023-02-08 21:08:01 +01:00 committed by Linus Groh
parent 14951b92ca
commit d43a7eae54
193 changed files with 536 additions and 556 deletions

View file

@ -8,7 +8,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <LibCore/File.h>
#include <LibCore/Forward.h>
#include "Common.h"
#include "Mesh.h"
@ -18,5 +18,5 @@ public:
MeshLoader() = default;
virtual ~MeshLoader() = default;
virtual ErrorOr<NonnullRefPtr<Mesh>> load(Core::File& file) = 0;
virtual ErrorOr<NonnullRefPtr<Mesh>> load(Core::DeprecatedFile& file) = 0;
};

View file

@ -8,7 +8,7 @@
#include "WavefrontOBJLoader.h"
#include <AK/FixedArray.h>
#include <LibCore/File.h>
#include <LibCore/DeprecatedFile.h>
#include <stdlib.h>
static inline GLuint get_index_value(StringView& representation)
@ -16,7 +16,7 @@ static inline GLuint get_index_value(StringView& representation)
return representation.to_uint().value_or(1) - 1;
}
ErrorOr<NonnullRefPtr<Mesh>> WavefrontOBJLoader::load(Core::File& file)
ErrorOr<NonnullRefPtr<Mesh>> WavefrontOBJLoader::load(Core::DeprecatedFile& file)
{
Vector<Vertex> vertices;
Vector<Vertex> normals;

View file

@ -18,5 +18,5 @@ public:
WavefrontOBJLoader() = default;
~WavefrontOBJLoader() override = default;
ErrorOr<NonnullRefPtr<Mesh>> load(Core::File& file) override;
ErrorOr<NonnullRefPtr<Mesh>> load(Core::DeprecatedFile& file) override;
};

View file

@ -6,7 +6,6 @@
*/
#include <LibCore/ElapsedTimer.h>
#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibFileSystemAccessClient/Client.h>
#include <LibGL/GL/gl.h>
@ -34,7 +33,7 @@ class GLContextWidget final : public GUI::Frame {
public:
bool load_path(DeprecatedString const& fname);
bool load_file(Core::File& file);
bool load_file(Core::DeprecatedFile& file);
void toggle_rotate_x() { m_rotate_x = !m_rotate_x; }
void toggle_rotate_y() { m_rotate_y = !m_rotate_y; }
void toggle_rotate_z() { m_rotate_z = !m_rotate_z; }
@ -291,7 +290,7 @@ void GLContextWidget::timer_event(Core::TimerEvent&)
bool GLContextWidget::load_path(DeprecatedString const& filename)
{
auto file = Core::File::construct(filename);
auto file = Core::DeprecatedFile::construct(filename);
if (!file->open(Core::OpenMode::ReadOnly) && file->error() != ENOENT) {
GUI::MessageBox::show(window(), DeprecatedString::formatted("Opening \"{}\" failed: {}", filename, strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
@ -301,7 +300,7 @@ bool GLContextWidget::load_path(DeprecatedString const& filename)
return load_file(file);
}
bool GLContextWidget::load_file(Core::File& file)
bool GLContextWidget::load_file(Core::DeprecatedFile& file)
{
auto const& filename = file.filename();
if (!filename.ends_with(".obj"sv)) {
@ -330,11 +329,11 @@ bool GLContextWidget::load_file(Core::File& file)
builder.append(filename.split('.').at(0));
builder.append(".bmp"sv);
DeprecatedString texture_path = Core::File::absolute_path(builder.string_view());
DeprecatedString texture_path = Core::DeprecatedFile::absolute_path(builder.string_view());
// Attempt to open the texture file from disk
RefPtr<Gfx::Bitmap> texture_image;
if (Core::File::exists(texture_path)) {
if (Core::DeprecatedFile::exists(texture_path)) {
auto bitmap_or_error = Gfx::Bitmap::load_from_file(texture_path);
if (!bitmap_or_error.is_error())
texture_image = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
@ -403,7 +402,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto file = response.value();
if (widget->load_file(*file)) {
auto canonical_path = Core::File::absolute_path(file->filename());
auto canonical_path = Core::DeprecatedFile::absolute_path(file->filename());
window->set_title(DeprecatedString::formatted("{} - 3D File Viewer", canonical_path));
}
}));
@ -592,7 +591,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto filename = arguments.argc > 1 ? arguments.argv[1] : "/home/anon/Documents/3D Models/teapot.obj";
if (widget->load_path(filename)) {
auto canonical_path = Core::File::absolute_path(filename);
auto canonical_path = Core::DeprecatedFile::absolute_path(filename);
window->set_title(DeprecatedString::formatted("{} - 3D File Viewer", canonical_path));
}

View file

@ -10,7 +10,6 @@
#include <AK/URL.h>
#include <LibCore/DirIterator.h>
#include <LibCore/ElapsedTimer.h>
#include <LibCore/File.h>
#include <LibCore/Process.h>
#include <LibCore/StandardPaths.h>
#include <LibDesktop/Launcher.h>
@ -23,6 +22,7 @@
#include <fcntl.h>
#include <serenity.h>
#include <spawn.h>
#include <sys/stat.h>
#include <unistd.h>
namespace Assistant {

View file

@ -14,7 +14,7 @@
#include <Applications/Browser/WindowActions.h>
#include <LibConfig/Client.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/File.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/FileWatcher.h>
#include <LibCore/StandardPaths.h>
#include <LibCore/System.h>
@ -131,8 +131,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
auto url_from_argument_string = [](DeprecatedString const& string) -> URL {
if (Core::File::exists(string)) {
return URL::create_with_file_scheme(Core::File::real_path_for(string));
if (Core::DeprecatedFile::exists(string)) {
return URL::create_with_file_scheme(Core::DeprecatedFile::real_path_for(string));
}
return Browser::url_from_user_input(string);
};

View file

@ -12,7 +12,6 @@
#include <AK/URL.h>
#include <Applications/CrashReporter/CrashReporterWindowGML.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibCoredump/Backtrace.h>
#include <LibCoredump/Reader.h>
@ -131,7 +130,7 @@ static TitleAndText build_cpu_registers(const ELF::Core::ThreadInfo& thread_info
static void unlink_coredump(StringView coredump_path)
{
if (Core::File::remove(coredump_path, Core::File::RecursionMode::Disallowed).is_error())
if (Core::DeprecatedFile::remove(coredump_path, Core::DeprecatedFile::RecursionMode::Disallowed).is_error())
dbgln("Failed deleting coredump file");
}

View file

@ -6,7 +6,6 @@
#include "ThemePreviewWidget.h"
#include <AK/Array.h>
#include <LibCore/File.h>
#include <LibGUI/Painter.h>
#include <LibGfx/Painter.h>
#include <LibGfx/StylePainter.h>

View file

@ -9,7 +9,7 @@
#include <AK/DeprecatedString.h>
#include <LibCore/Account.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/File.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibGUI/Application.h>
#include <LibGUI/Desktop.h>
@ -33,7 +33,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto app = TRY(GUI::Application::try_create(arguments));
auto executable_path = Core::File::resolve_executable_from_environment(command[0]);
auto executable_path = Core::DeprecatedFile::resolve_executable_from_environment(command[0]);
if (!executable_path.has_value()) {
GUI::MessageBox::show_error(nullptr, DeprecatedString::formatted("Could not execute command {}: Command not found.", command[0]));
return 127;

View file

@ -11,7 +11,7 @@
#include <AK/NumberFormat.h>
#include <AK/StringBuilder.h>
#include <LibConfig/Client.h>
#include <LibCore/File.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/MimeData.h>
#include <LibCore/StandardPaths.h>
#include <LibGUI/FileIconProvider.h>
@ -204,7 +204,7 @@ void DirectoryView::setup_model()
while (model_root.string() != "/") {
model_root = model_root.parent();
if (Core::File::is_directory(model_root.string()))
if (Core::DeprecatedFile::is_directory(model_root.string()))
break;
}
@ -405,8 +405,8 @@ void DirectoryView::add_path_to_history(DeprecatedString path)
bool DirectoryView::open(DeprecatedString const& path)
{
auto real_path = Core::File::real_path_for(path);
if (real_path.is_null() || !Core::File::is_directory(path))
auto real_path = Core::DeprecatedFile::real_path_for(path);
if (real_path.is_null() || !Core::DeprecatedFile::is_directory(path))
return false;
if (chdir(real_path.characters()) < 0) {
@ -555,7 +555,7 @@ bool DirectoryView::can_modify_current_selection()
// FIXME: remove once Clang formats this properly.
// clang-format off
return selections.first_matching([&](auto& index) {
return Core::File::can_delete_or_move(node(index).full_path());
return Core::DeprecatedFile::can_delete_or_move(node(index).full_path());
}).has_value();
// clang-format on
}

View file

@ -8,7 +8,6 @@
#include "FileOperationProgressWidget.h"
#include "FileUtils.h"
#include <Applications/FileManager/FileOperationProgressGML.h>
#include <LibCore/File.h>
#include <LibCore/Notifier.h>
#include <LibGUI/Button.h>
#include <LibGUI/ImageWidget.h>

View file

@ -8,7 +8,7 @@
#include "FileUtils.h"
#include "FileOperationProgressWidget.h"
#include <AK/LexicalPath.h>
#include <LibCore/File.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/MimeData.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
@ -125,7 +125,7 @@ ErrorOr<bool> handle_drop(GUI::DropEvent const& event, DeprecatedString const& d
auto const target = LexicalPath::canonicalized_path(destination);
if (!Core::File::is_directory(target))
if (!Core::DeprecatedFile::is_directory(target))
return has_accepted_drop;
Vector<DeprecatedString> paths_to_copy;

View file

@ -10,6 +10,7 @@
#include <AK/NumberFormat.h>
#include <Applications/FileManager/DirectoryView.h>
#include <Applications/FileManager/PropertiesWindowGeneralTabGML.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/System.h>
#include <LibDesktop/Launcher.h>
@ -102,7 +103,7 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename)
type->set_text(get_description(m_mode));
if (S_ISLNK(m_mode)) {
auto link_destination_or_error = Core::File::read_link(m_path);
auto link_destination_or_error = Core::DeprecatedFile::read_link(m_path);
if (link_destination_or_error.is_error()) {
perror("readlink");
} else {
@ -214,7 +215,7 @@ bool PropertiesWindow::apply_changes()
DeprecatedString new_name = m_name_box->text();
DeprecatedString new_file = make_full_path(new_name).characters();
if (Core::File::exists(new_file)) {
if (Core::DeprecatedFile::exists(new_file)) {
GUI::MessageBox::show(this, DeprecatedString::formatted("A file \"{}\" already exists!", new_name), "Error"sv, GUI::MessageBox::Type::Error);
return false;
}

View file

@ -8,7 +8,6 @@
#pragma once
#include <AK/Queue.h>
#include <LibCore/File.h>
#include <LibGUI/Button.h>
#include <LibGUI/Dialog.h>
#include <LibGUI/FileSystemModel.h>

View file

@ -19,7 +19,7 @@
#include <LibConfig/Client.h>
#include <LibConfig/Listener.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/File.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/Process.h>
#include <LibCore/StandardPaths.h>
#include <LibCore/System.h>
@ -107,14 +107,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (!initial_location.is_empty()) {
if (!ignore_path_resolution)
initial_location = Core::File::real_path_for(initial_location);
initial_location = Core::DeprecatedFile::real_path_for(initial_location);
if (!Core::File::is_directory(initial_location))
if (!Core::DeprecatedFile::is_directory(initial_location))
is_selection_mode = true;
}
if (initial_location.is_empty())
initial_location = Core::File::current_working_directory();
initial_location = Core::DeprecatedFile::current_working_directory();
if (initial_location.is_empty())
initial_location = Core::StandardPaths::home_directory();
@ -188,7 +188,7 @@ void do_create_link(Vector<DeprecatedString> const& selected_file_paths, GUI::Wi
{
auto path = selected_file_paths.first();
auto destination = DeprecatedString::formatted("{}/{}", Core::StandardPaths::desktop_directory(), LexicalPath::basename(path));
if (auto result = Core::File::link_file(destination, path); result.is_error()) {
if (auto result = Core::DeprecatedFile::link_file(destination, path); result.is_error()) {
GUI::MessageBox::show(window, DeprecatedString::formatted("Could not create desktop shortcut:\n{}", result.error()), "File Manager"sv,
GUI::MessageBox::Type::Error);
}
@ -456,7 +456,7 @@ ErrorOr<int> run_in_desktop_mode()
}
for (auto& path : paths) {
if (Core::File::is_directory(path))
if (Core::DeprecatedFile::is_directory(path))
Desktop::Launcher::open(URL::create_with_file_scheme(path));
}
});
@ -469,7 +469,7 @@ ErrorOr<int> run_in_desktop_mode()
}
for (auto& path : paths) {
if (Core::File::is_directory(path)) {
if (Core::DeprecatedFile::is_directory(path)) {
spawn_terminal(path);
}
}
@ -814,7 +814,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
paths = directory_view->selected_file_paths();
for (auto& path : paths) {
if (Core::File::is_directory(path))
if (Core::DeprecatedFile::is_directory(path))
Desktop::Launcher::open(URL::create_with_file_scheme(path));
}
},
@ -833,7 +833,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
paths = directory_view->selected_file_paths();
for (auto& path : paths) {
if (Core::File::is_directory(path)) {
if (Core::DeprecatedFile::is_directory(path)) {
spawn_terminal(path);
}
}
@ -1090,7 +1090,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
if (!segment_index.has_value())
return;
auto selected_path = breadcrumbbar.segment_data(*segment_index);
if (Core::File::is_directory(selected_path)) {
if (Core::DeprecatedFile::is_directory(selected_path)) {
directory_view->open(selected_path);
} else {
dbgln("Breadcrumb path '{}' doesn't exist", selected_path);
@ -1121,7 +1121,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
// If the path change was because the directory we were in was deleted,
// remove the breadcrumbs for it.
if ((new_segment_index + 1 < breadcrumbbar.segment_count())
&& !Core::File::is_directory(breadcrumbbar.segment_data(new_segment_index + 1))) {
&& !Core::DeprecatedFile::is_directory(breadcrumbbar.segment_data(new_segment_index + 1))) {
breadcrumbbar.remove_end_segments(new_segment_index + 1);
}
} else {

View file

@ -14,7 +14,6 @@
#include <AK/URL.h>
#include <Applications/Help/HelpWindowGML.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibDesktop/Launcher.h>
#include <LibGUI/Action.h>

View file

@ -6,11 +6,13 @@
#pragma once
#include <AK/HashMap.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/StringView.h>
#include <AK/Time.h>
#include <AK/Types.h>
#include <AK/WeakPtr.h>
#include <LibCore/File.h>
#include <LibCore/Forward.h>
#include <LibGUI/Command.h>
constexpr Time COMMAND_COMMIT_TIME = Time::from_milliseconds(400);

View file

@ -11,8 +11,8 @@
#include "ViewWidget.h"
#include <AK/LexicalPath.h>
#include <AK/StringBuilder.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/File.h>
#include <LibCore/MappedFile.h>
#include <LibCore/MimeData.h>
#include <LibCore/Timer.h>
@ -195,7 +195,7 @@ void ViewWidget::load_from_file(DeprecatedString const& path)
m_timer->stop();
}
m_path = Core::File::real_path_for(path);
m_path = Core::DeprecatedFile::real_path_for(path);
reset_view();
}

View file

@ -12,8 +12,8 @@
#include <Applications/KeyboardSettings/KeyboardWidgetGML.h>
#include <Applications/KeyboardSettings/KeymapDialogGML.h>
#include <LibConfig/Client.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/File.h>
#include <LibGUI/Application.h>
#include <LibGUI/ComboBox.h>
#include <LibGUI/Dialog.h>
@ -153,7 +153,7 @@ KeyboardSettingsWidget::KeyboardSettingsWidget()
{
load_from_gml(keyboard_widget_gml).release_value_but_fixme_should_propagate_errors();
auto proc_keymap = Core::File::construct("/sys/kernel/keymap");
auto proc_keymap = Core::DeprecatedFile::construct("/sys/kernel/keymap");
if (!proc_keymap->open(Core::OpenMode::ReadOnly))
VERIFY_NOT_REACHED();

View file

@ -11,7 +11,6 @@
#include <AK/JsonParser.h>
#include <Applications/NetworkSettings/NetworkSettingsGML.h>
#include <LibCore/Command.h>
#include <LibCore/File.h>
#include <LibGUI/CheckBox.h>
#include <LibGUI/ComboBox.h>
#include <LibGUI/ItemListModel.h>

View file

@ -9,7 +9,6 @@
#include <LibGUI/MessageBox.h>
#include <unistd.h>
#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibGUI/Application.h>
#include <LibGUI/Icon.h>

View file

@ -12,7 +12,6 @@
#include <AK/HashMap.h>
#include <AK/HashTable.h>
#include <AK/Variant.h>
#include <LibCore/File.h>
#include <LibFileSystemAccessClient/Client.h>
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>

View file

@ -6,6 +6,7 @@
#include <AK/NumberFormat.h>
#include <Applications/PartitionEditor/PartitionModel.h>
#include <LibCore/DeprecatedFile.h>
#include <LibPartition/EBRPartitionTable.h>
#include <LibPartition/GUIDPartitionTable.h>
#include <LibPartition/MBRPartitionTable.h>
@ -62,7 +63,7 @@ GUI::Variant PartitionModel::data(GUI::ModelIndex const& index, GUI::ModelRole r
ErrorOr<void> PartitionModel::set_device_path(DeprecatedString const& path)
{
auto file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly));
auto file = TRY(Core::DeprecatedFile::open(path, Core::OpenMode::ReadOnly));
auto mbr_table_or_error = Partition::MBRPartitionTable::try_to_initialize(file);
if (!mbr_table_or_error.is_error()) {

View file

@ -6,6 +6,7 @@
#include <Applications/PartitionEditor/PartitionEditorWindowGML.h>
#include <Applications/PartitionEditor/PartitionModel.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/System.h>
#include <LibGUI/Application.h>
@ -22,7 +23,7 @@ static Vector<DeprecatedString> get_device_paths()
Core::DirIterator iterator("/dev", Core::DirIterator::SkipParentAndBaseDir);
while (iterator.has_next()) {
auto path = iterator.next_full_path();
if (Core::File::is_block_device(path))
if (Core::DeprecatedFile::is_block_device(path))
device_paths.append(path);
}
return device_paths;

View file

@ -9,7 +9,7 @@
#include <AK/LexicalPath.h>
#include <AK/URL.h>
#include <Applications/Run/RunGML.h>
#include <LibCore/File.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/StandardPaths.h>
#include <LibCore/Stream.h>
#include <LibDesktop/Launcher.h>
@ -143,9 +143,9 @@ bool RunWindow::run_via_launch(DeprecatedString const& run_input)
auto url = URL::create_with_url_or_path(run_input);
if (url.scheme() == "file") {
auto real_path = Core::File::real_path_for(url.path());
auto real_path = Core::DeprecatedFile::real_path_for(url.path());
if (real_path.is_null()) {
// errno *should* be preserved from Core::File::real_path_for().
// errno *should* be preserved from Core::DeprecatedFile::real_path_for().
warnln("Failed to launch '{}': {}", url.path(), strerror(errno));
return false;
}

View file

@ -8,7 +8,7 @@
#include "AlbumCoverVisualizationWidget.h"
#include <AK/LexicalPath.h>
#include <LibCore/File.h>
#include <LibCore/DeprecatedFile.h>
#include <LibGUI/Painter.h>
#include <LibGfx/Rect.h>
@ -48,7 +48,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> AlbumCoverVisualizationWidget::get_album_cov
static constexpr auto possible_cover_filenames = Array { "cover.png"sv, "cover.jpg"sv };
for (auto& it : possible_cover_filenames) {
LexicalPath cover_path = LexicalPath::join(directory, it);
if (Core::File::exists(cover_path.string()))
if (Core::DeprecatedFile::exists(cover_path.string()))
return Gfx::Bitmap::load_from_file(cover_path.string());
}

View file

@ -7,7 +7,7 @@
#include "Player.h"
#include <LibAudio/FlacLoader.h>
#include <LibCore/File.h>
#include <LibCore/DeprecatedFile.h>
Player::Player(Audio::ConnectionToServer& audio_client_connection)
: m_audio_client_connection(audio_client_connection)
@ -44,7 +44,7 @@ void Player::play_file_path(DeprecatedString const& path)
if (path.is_null())
return;
if (!Core::File::exists(path)) {
if (!Core::DeprecatedFile::exists(path)) {
audio_load_error(path, "File does not exist"sv);
return;
}

View file

@ -10,7 +10,7 @@
#include <AK/LexicalPath.h>
#include <AK/Random.h>
#include <LibAudio/Loader.h>
#include <LibCore/File.h>
#include <LibCore/DeprecatedFile.h>
#include <LibGUI/MessageBox.h>
bool Playlist::load(StringView path)
@ -39,11 +39,11 @@ void Playlist::try_fill_missing_info(Vector<M3UEntry>& entries, StringView path)
entry.path = DeprecatedString::formatted("{}/{}", playlist_path.dirname(), entry.path);
if (!entry.extended_info->file_size_in_bytes.has_value()) {
auto size = Core::File::size(entry.path);
auto size = Core::DeprecatedFile::size(entry.path);
if (size.is_error())
continue;
entry.extended_info->file_size_in_bytes = size.value();
} else if (!Core::File::exists(entry.path)) {
} else if (!Core::DeprecatedFile::exists(entry.path)) {
to_delete.append(&entry);
continue;
}

View file

@ -11,7 +11,7 @@
#include <AK/String.h>
#include <AK/URL.h>
#include <Applications/SpaceAnalyzer/SpaceAnalyzerGML.h>
#include <LibCore/File.h>
#include <LibCore/DeprecatedFile.h>
#include <LibDesktop/Launcher.h>
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>
@ -97,7 +97,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
while (try_again) {
try_again = false;
auto deletion_result = Core::File::remove(selected_node_path, Core::File::RecursionMode::Allowed);
auto deletion_result = Core::DeprecatedFile::remove(selected_node_path, Core::DeprecatedFile::RecursionMode::Allowed);
if (deletion_result.is_error()) {
auto retry_message_result = GUI::MessageBox::show(window,
DeprecatedString::formatted("Failed to delete \"{}\": {}. Retry?",
@ -164,8 +164,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
DeprecatedString selected_node_path = get_absolute_path_to_selected_node(tree_map_widget);
if (selected_node_path.is_empty())
return;
delete_action->set_enabled(Core::File::can_delete_or_move(selected_node_path));
if (Core::File::is_directory(selected_node_path)) {
delete_action->set_enabled(Core::DeprecatedFile::can_delete_or_move(selected_node_path));
if (Core::DeprecatedFile::is_directory(selected_node_path)) {
open_folder_action->set_visible(true);
open_containing_folder_action->set_visible(false);
} else {

View file

@ -10,7 +10,6 @@
#include <AK/LexicalPath.h>
#include <Applications/Spreadsheet/CSVImportGML.h>
#include <Applications/Spreadsheet/FormatSelectionPageGML.h>
#include <LibCore/File.h>
#include <LibGUI/Application.h>
#include <LibGUI/CheckBox.h>
#include <LibGUI/ComboBox.h>

View file

@ -9,7 +9,6 @@
#include "../CSV.h"
#include "../XSV.h"
#include <AK/ByteBuffer.h>
#include <LibCore/File.h>
#include <string.h>
TEST_CASE(should_parse_valid_data)

View file

@ -16,7 +16,7 @@
#include <AK/ScopeGuard.h>
#include <AK/TemporaryChange.h>
#include <AK/URL.h>
#include <LibCore/File.h>
#include <LibCore/DeprecatedFile.h>
#include <LibJS/Interpreter.h>
#include <LibJS/Parser.h>
#include <LibJS/Runtime/AbstractOperations.h>
@ -49,7 +49,7 @@ Sheet::Sheet(Workbook& workbook)
// Sadly, these have to be evaluated once per sheet.
constexpr auto runtime_file_path = "/res/js/Spreadsheet/runtime.js"sv;
auto file_or_error = Core::File::open(runtime_file_path, Core::OpenMode::ReadOnly);
auto file_or_error = Core::DeprecatedFile::open(runtime_file_path, Core::OpenMode::ReadOnly);
if (!file_or_error.is_error()) {
auto buffer = file_or_error.value()->read_all();
auto script_or_error = JS::Script::parse(buffer, interpreter().realm(), runtime_file_path);

View file

@ -10,7 +10,6 @@
#include <AK/ScopeGuard.h>
#include <AK/Try.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibFileSystemAccessClient/Client.h>
#include <LibGUI/Application.h>
@ -34,7 +33,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.parse(arguments);
if (filename) {
if (!Core::File::exists({ filename, strlen(filename) }) || Core::File::is_directory(filename)) {
if (!Core::DeprecatedFile::exists({ filename, strlen(filename) }) || Core::DeprecatedFile::is_directory(filename)) {
warnln("File does not exist or is a directory: {}", filename);
return 1;
}

View file

@ -9,7 +9,7 @@
#include "GraphWidget.h"
#include <AK/JsonObject.h>
#include <AK/NumberFormat.h>
#include <LibCore/File.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/Object.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Label.h>
@ -104,7 +104,7 @@ static inline u64 page_count_to_bytes(size_t count)
void MemoryStatsWidget::refresh()
{
auto proc_memstat = Core::File::construct("/sys/kernel/memstat");
auto proc_memstat = Core::DeprecatedFile::construct("/sys/kernel/memstat");
if (!proc_memstat->open(Core::OpenMode::ReadOnly))
VERIFY_NOT_REACHED();

View file

@ -10,7 +10,7 @@
#include <AK/JsonValue.h>
#include <AK/NonnullRefPtr.h>
#include <AK/NumberFormat.h>
#include <LibCore/File.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/ProcessStatisticsReader.h>
#include <LibCore/Stream.h>
#include <LibGUI/FileIconProvider.h>
@ -32,7 +32,7 @@ ProcessModel::ProcessModel()
VERIFY(!s_the);
s_the = this;
auto file = Core::File::construct("/sys/kernel/cpuinfo");
auto file = Core::DeprecatedFile::construct("/sys/kernel/cpuinfo");
if (file->open(Core::OpenMode::ReadOnly)) {
auto buffer = file->read_all();
auto json = JsonValue::from_string({ buffer });

View file

@ -245,7 +245,7 @@ private:
HashMap<int, NonnullRefPtr<Thread>> m_threads;
NonnullOwnPtrVector<Process> m_processes;
NonnullOwnPtrVector<CpuInfo> m_cpus;
RefPtr<Core::File> m_proc_all;
RefPtr<Core::DeprecatedFile> m_proc_all;
GUI::Icon m_kernel_process_icon;
u64 m_total_time_scheduled { 0 };
u64 m_total_time_scheduled_kernel { 0 };

View file

@ -10,8 +10,8 @@
#include <LibConfig/Client.h>
#include <LibConfig/Listener.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibDesktop/Launcher.h>
#include <LibGUI/Action.h>

View file

@ -12,7 +12,6 @@
#include <Applications/TerminalSettings/TerminalSettingsViewGML.h>
#include <LibConfig/Client.h>
#include <LibCore/DirIterator.h>
#include <LibCore/File.h>
#include <LibGUI/Application.h>
#include <LibGUI/Button.h>
#include <LibGUI/CheckBox.h>

View file

@ -6,7 +6,6 @@
*/
#include "FileArgument.h"
#include <LibCore/File.h>
#include <LibRegex/Regex.h>
namespace TextEditor {

View file

@ -12,7 +12,6 @@
#include <Applications/TextEditor/TextEditorWindowGML.h>
#include <LibConfig/Client.h>
#include <LibCore/Debounce.h>
#include <LibCore/File.h>
#include <LibCpp/SyntaxHighlighter.h>
#include <LibDesktop/Launcher.h>
#include <LibGUI/Action.h>

View file

@ -589,8 +589,8 @@ void MainWidget::show_path_picker_dialog(StringView property_display_name, GUI::
bool open_folder = path_picker_target == PathPickerTarget::Folder;
auto window_title = DeprecatedString::formatted(open_folder ? "Select {} folder"sv : "Select {} file"sv, property_display_name);
auto target_path = path_input.text();
if (Core::File::exists(target_path)) {
if (!Core::File::is_directory(target_path))
if (Core::DeprecatedFile::exists(target_path)) {
if (!Core::DeprecatedFile::is_directory(target_path))
target_path = LexicalPath::dirname(target_path);
} else {
target_path = "/res/icons";

View file

@ -36,7 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Optional<DeprecatedString> path = {};
if (!file_to_edit.is_empty())
path = Core::File::absolute_path(file_to_edit);
path = Core::DeprecatedFile::absolute_path(file_to_edit);
TRY(Core::System::pledge("stdio recvfd sendfd thread rpath unix"));
TRY(Core::System::unveil("/tmp/session/%sid/portal/filesystemaccess", "rw"));