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

Everywhere: Use LibFileSystem where trivial

This commit is contained in:
Cameron Youell 2023-03-22 02:35:30 +11:00 committed by Linus Groh
parent edab0cbf41
commit 1d24f394c6
115 changed files with 275 additions and 228 deletions

View file

@ -143,4 +143,4 @@ set(GENERATED_SOURCES
)
serenity_lib(LibGUI gui)
target_link_libraries(LibGUI PRIVATE LibCore LibGfx LibIPC LibThreading LibRegex LibSyntax LibConfig LibUnicode)
target_link_libraries(LibGUI PRIVATE LibCore LibFileSystem LibGfx LibIPC LibThreading LibRegex LibSyntax LibConfig LibUnicode)

View file

@ -8,9 +8,9 @@
#include <AK/JsonArray.h>
#include <AK/JsonObject.h>
#include <AK/Vector.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/File.h>
#include <LibCore/StandardPaths.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGUI/CommonLocationsProvider.h>
#include <unistd.h>
@ -25,7 +25,7 @@ static void initialize_if_needed()
return;
auto user_config = DeprecatedString::formatted("{}/CommonLocations.json", Core::StandardPaths::config_directory());
if (Core::DeprecatedFile::exists(user_config)) {
if (FileSystem::exists(user_config)) {
auto maybe_error = CommonLocationsProvider::load_from_json(user_config);
if (!maybe_error.is_error())
return;

View file

@ -7,8 +7,8 @@
#include <AK/Function.h>
#include <AK/LexicalPath.h>
#include <LibConfig/Client.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/StandardPaths.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGUI/Action.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
@ -320,7 +320,7 @@ void FilePicker::on_file_return()
path = LexicalPath::join(m_model->root_path(), path).string();
}
bool file_exists = Core::DeprecatedFile::exists(path);
bool file_exists = FileSystem::exists(path);
if (!file_exists && (m_mode == Mode::Open || m_mode == Mode::OpenFolder)) {
MessageBox::show(this, DeprecatedString::formatted("No such file or directory: {}", m_filename_textbox->text()), "File not found"sv, MessageBox::Type::Error, MessageBox::InputType::OK);

View file

@ -9,8 +9,8 @@
#include "PathBreadcrumbbar.h"
#include <AK/LexicalPath.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/MimeData.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Breadcrumbbar.h>
#include <LibGUI/FileIconProvider.h>
@ -49,7 +49,7 @@ PathBreadcrumbbar::PathBreadcrumbbar(NonnullRefPtr<GUI::TextBox> location_text_b
};
m_location_text_box->on_return_pressed = [&] {
if (Core::DeprecatedFile::is_directory(m_location_text_box->text())) {
if (FileSystem::is_directory(m_location_text_box->text())) {
set_current_path(m_location_text_box->text());
hide_location_text_box();
}
@ -104,7 +104,7 @@ void PathBreadcrumbbar::set_current_path(DeprecatedString const& new_path)
// If the path change was because the directory we were in was deleted,
// remove the breadcrumbs for it.
if ((new_segment_index + 1 < m_breadcrumbbar->segment_count())
&& !Core::DeprecatedFile::is_directory(m_breadcrumbbar->segment_data(new_segment_index + 1))) {
&& !FileSystem::is_directory(m_breadcrumbbar->segment_data(new_segment_index + 1))) {
m_breadcrumbbar->remove_end_segments(new_segment_index + 1);
}
} else {