mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:17:44 +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:
parent
14951b92ca
commit
d43a7eae54
193 changed files with 536 additions and 556 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue