1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:27:35 +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

@ -12,8 +12,8 @@
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/URL.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
#include <LibFileSystem/FileSystem.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
@ -676,7 +676,7 @@ ErrorOr<void> BarewordLiteral::highlight_in_editor(Line::Editor& editor, Shell&
editor.stylize({ m_position.start_offset, m_position.end_offset }, { Line::Style::Foreground(Line::Style::XtermColor::Cyan) });
}
}
if (Core::DeprecatedFile::exists(m_text)) {
if (FileSystem::exists(m_text)) {
auto realpath = shell.resolve_path(m_text.bytes_as_string_view());
auto url = URL::create_with_file_scheme(realpath);
url.set_host(shell.hostname);
@ -3209,7 +3209,7 @@ ErrorOr<void> Juxtaposition::highlight_in_editor(Line::Editor& editor, Shell& sh
path_builder.append(bareword_value);
auto path = path_builder.to_deprecated_string();
if (Core::DeprecatedFile::exists(path)) {
if (FileSystem::exists(path)) {
auto realpath = shell.resolve_path(path);
auto url = URL::create_with_file_scheme(realpath);
url.set_host(shell.hostname);

View file

@ -18,7 +18,7 @@ set(SOURCES
)
serenity_lib(LibShell shell)
target_link_libraries(LibShell PRIVATE LibCore LibLine LibSyntax LibRegex)
target_link_libraries(LibShell PRIVATE LibCore LibFileSystem LibLine LibSyntax LibRegex)
if (SERENITYOS)
target_sources(LibShell PRIVATE SyntaxHighlighter.cpp)
@ -31,7 +31,7 @@ else()
set(SOURCES main.cpp)
serenity_bin(Shell)
target_link_libraries(Shell PRIVATE LibCore LibLine LibShell LibMain)
target_link_libraries(Shell PRIVATE LibCore LibFileSystem LibLine LibShell LibMain)
install(DIRECTORY Tests/ DESTINATION usr/Tests/Shell
PATTERN "Tests/*"

View file

@ -11,6 +11,7 @@
#include <LibCore/Event.h>
#include <LibCore/EventLoop.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
#include <LibMain/Main.h>
#include <signal.h>
#include <stdio.h>
@ -227,7 +228,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
DeprecatedString file_path = name;
if (file_path.starts_with('~'))
file_path = shell->expand_tilde(file_path);
if (Core::DeprecatedFile::exists(file_path)) {
if (FileSystem::exists(file_path)) {
shell->run_file(file_path, false);
}
};