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
Notes: sideshowbarker 2024-07-16 22:54:10 +09:00
115 changed files with 275 additions and 228 deletions

View file

@ -97,7 +97,7 @@ set(SOURCES
qt_add_executable(ladybird ${SOURCES}
MANUAL_FINALIZATION
)
target_link_libraries(ladybird PRIVATE Qt::Core Qt::Gui Qt::Network Qt::Widgets LibCore LibGfx LibGUI LibIPC LibJS LibMain LibWeb LibWebView LibSQL)
target_link_libraries(ladybird PRIVATE Qt::Core Qt::Gui Qt::Network Qt::Widgets LibCore LibFileSystem LibGfx LibGUI LibIPC LibJS LibMain LibWeb LibWebView LibSQL)
target_include_directories(ladybird PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(ladybird PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Applications/)
@ -110,7 +110,7 @@ qt_add_executable(headless-browser
Utilities.cpp)
target_include_directories(headless-browser PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(headless-browser PRIVATE Qt::Core LibWeb LibWebView LibWebSocket LibCrypto LibGemini LibHTTP LibJS LibGfx LibMain LibTLS LibIPC LibJS)
target_link_libraries(headless-browser PRIVATE Qt::Core LibWeb LibWebView LibWebSocket LibCrypto LibFileSystem LibGemini LibHTTP LibJS LibGfx LibMain LibTLS LibIPC LibJS)
set_target_properties(ladybird PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER org.serenityos.ladybird

View file

@ -11,4 +11,4 @@ qt_add_executable(SQLServer ${SQL_SERVER_SOURCES})
target_include_directories(SQLServer PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Services/)
target_include_directories(SQLServer PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..)
target_link_libraries(SQLServer PRIVATE Qt::Core Qt::Gui Qt::Network LibCore LibIPC LibSQL LibMain)
target_link_libraries(SQLServer PRIVATE Qt::Core Qt::Gui Qt::Network LibCore LibFileSystem LibIPC LibSQL LibMain)

View file

@ -9,7 +9,7 @@
#include "Utilities.h"
#include <AK/LexicalPath.h>
#include <AK/Platform.h>
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.h>
#include <QCoreApplication>
DeprecatedString s_serenity_resource_root;
@ -49,7 +49,7 @@ void platform_init()
auto* home = getenv("XDG_CONFIG_HOME") ?: getenv("HOME");
VERIFY(home);
auto home_lagom = DeprecatedString::formatted("{}/.lagom", home);
if (Core::DeprecatedFile::is_directory(home_lagom))
if (FileSystem::is_directory(home_lagom))
return home_lagom;
auto app_dir = ak_deprecated_string_from_qstring(QCoreApplication::applicationDirPath());
return LexicalPath(app_dir).parent().append("share"sv).string();

View file

@ -22,4 +22,4 @@ qt_add_executable(WebContent ${WEBCONTENT_SOURCES})
target_include_directories(WebContent PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Services/)
target_include_directories(WebContent PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..)
target_link_libraries(WebContent PRIVATE Qt::Core Qt::Gui Qt::Network LibCore LibGfx LibIPC LibJS LibMain LibWeb LibWebSocket)
target_link_libraries(WebContent PRIVATE Qt::Core Qt::Gui Qt::Network LibCore LibFileSystem LibGfx LibIPC LibJS LibMain LibWeb LibWebSocket)

View file

@ -15,5 +15,5 @@ target_include_directories(WebDriver PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..)
target_include_directories(WebDriver PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..)
target_include_directories(WebDriver PRIVATE ${SERENITY_SOURCE_DIR}/Userland)
target_include_directories(WebDriver PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Services)
target_link_libraries(WebDriver PRIVATE Qt::Core Qt::Network LibCore LibGfx LibIPC LibJS LibMain LibWeb LibWebSocket)
target_link_libraries(WebDriver PRIVATE Qt::Core Qt::Network LibCore LibFileSystem LibGfx LibIPC LibJS LibMain LibWeb LibWebSocket)
add_dependencies(WebDriver headless-browser)

View file

@ -16,6 +16,7 @@
#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGfx/Font/FontDatabase.h>
#include <LibMain/Main.h>
#include <LibSQL/SQLClient.h>
@ -76,7 +77,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto get_formatted_url = [&](StringView const& raw_url) -> URL {
URL url = raw_url;
if (Core::DeprecatedFile::exists(raw_url))
if (FileSystem::exists(raw_url))
url = URL::create_with_file_scheme(Core::DeprecatedFile::real_path_for(raw_url));
else if (!url.is_valid())
url = DeprecatedString::formatted("http://{}", raw_url);

View file

@ -122,7 +122,7 @@ if (NOT COMMAND serenity_test)
add_dependencies(ComponentTests ${test_name})
set_target_properties(${test_name} PROPERTIES EXCLUDE_FROM_ALL TRUE)
serenity_set_implicit_links(${test_name})
target_link_libraries(${test_name} PRIVATE LibTest LibCore)
target_link_libraries(${test_name} PRIVATE LibTest LibCore LibFileSystem)
foreach(lib ${SERENITY_TEST_LIBS})
target_link_libraries(${test_name} PRIVATE ${lib})
endforeach()
@ -135,7 +135,7 @@ function(serenity_testjs_test test_src sub_dir)
if ("${SERENITY_TEST_CUSTOM_MAIN}" STREQUAL "")
set(SERENITY_TEST_CUSTOM_MAIN "$<TARGET_OBJECTS:JavaScriptTestRunnerMain>")
endif()
list(APPEND SERENITY_TEST_LIBS LibJS LibCore)
list(APPEND SERENITY_TEST_LIBS LibJS LibCore LibFileSystem)
serenity_test(${test_src} ${sub_dir}
CUSTOM_MAIN "${SERENITY_TEST_CUSTOM_MAIN}"
LIBS ${SERENITY_TEST_LIBS})

View file

@ -251,7 +251,7 @@ function(lagom_test source)
cmake_parse_arguments(LAGOM_TEST "" "WORKING_DIRECTORY" "LIBS" ${ARGN})
get_filename_component(name ${source} NAME_WE)
add_executable(${name} ${source})
target_link_libraries(${name} PRIVATE LibCore LibTest LibTestMain ${LAGOM_TEST_LIBS})
target_link_libraries(${name} PRIVATE LibCore LibFileSystem LibTest LibTestMain ${LAGOM_TEST_LIBS})
add_test(
NAME ${name}
COMMAND ${name}
@ -346,6 +346,10 @@ target_sources(LibCore PRIVATE ${AK_SOURCES})
# LibMain
add_serenity_subdirectory(Userland/Libraries/LibMain)
# LibFileSystem
# This is needed even if Lagom is not enabled because it is depended upon by code generators.
add_serenity_subdirectory(Userland/Libraries/LibFileSystem)
# LibTimeZone
# This is needed even if Lagom is not enabled because it is depended upon by code generators.
add_serenity_subdirectory(Userland/Libraries/LibTimeZone)
@ -524,7 +528,7 @@ if (BUILD_LAGOM)
endif()
add_executable(markdown-check ../../Userland/Utilities/markdown-check.cpp)
target_link_libraries(markdown-check LibMarkdown LibMain)
target_link_libraries(markdown-check LibFileSystem LibMarkdown LibMain)
if (NOT EMSCRIPTEN)
add_executable(ntpquery ../../Userland/Utilities/ntpquery.cpp)
@ -532,10 +536,10 @@ if (BUILD_LAGOM)
endif()
add_executable(sql ../../Userland/Utilities/sql.cpp)
target_link_libraries(sql LibCore LibIPC LibLine LibMain LibSQL)
target_link_libraries(sql LibCore LibFileSystem LibIPC LibLine LibMain LibSQL)
add_executable(test262-runner ../../Tests/LibJS/test262-runner.cpp)
target_link_libraries(test262-runner LibJS LibCore)
target_link_libraries(test262-runner LibJS LibCore LibFileSystem)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
include(CheckCSourceCompiles)
@ -554,7 +558,7 @@ if (BUILD_LAGOM)
endif()
add_executable(wasm ../../Userland/Utilities/wasm.cpp)
target_link_libraries(wasm LibCore LibWasm LibLine LibMain LibJS)
target_link_libraries(wasm LibCore LibFileSystem LibWasm LibLine LibMain LibJS)
add_executable(xml ../../Userland/Utilities/xml.cpp)
target_link_libraries(xml LibCore LibXML LibMain)
@ -567,7 +571,7 @@ if (BUILD_LAGOM)
LibTest
${LIBTEST_SOURCES}
)
target_link_libraries(LibTest PRIVATE LibCore)
target_link_libraries(LibTest PRIVATE LibCore LibFileSystem)
set_target_properties(LibTest PROPERTIES OUTPUT_NAME lagom-test)
add_library(
LibTestMain
@ -622,7 +626,7 @@ if (BUILD_LAGOM)
add_executable(test-js
../../Tests/LibJS/test-js.cpp
../../Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp)
target_link_libraries(test-js LibCore LibTest LibJS)
target_link_libraries(test-js LibCore LibFileSystem LibTest LibJS)
add_test(
NAME JS
COMMAND test-js --show-progress=false
@ -638,7 +642,7 @@ if (BUILD_LAGOM)
add_executable(test-spreadsheet
../../Tests/Spreadsheet/test-spreadsheet.cpp
../../Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp)
target_link_libraries(test-spreadsheet LibCore LibTest LibJS)
target_link_libraries(test-spreadsheet LibCore LibFileSystem LibTest LibJS)
add_test(
NAME Spreadsheet
COMMAND test-spreadsheet --show-progress=false
@ -649,7 +653,7 @@ if (BUILD_LAGOM)
add_executable(test-wasm
../../Tests/LibWasm/test-wasm.cpp
../../Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp)
target_link_libraries(test-wasm LibCore LibTest LibWasm LibJS)
target_link_libraries(test-wasm LibCore LibFileSystem LibTest LibWasm LibJS)
add_test(
NAME WasmParser
COMMAND test-wasm --show-progress=false ${CMAKE_CURRENT_BINARY_DIR}/Userland/Libraries/LibWasm/Tests

View file

@ -3,7 +3,7 @@ function(lagom_tool tool)
add_executable(${tool} ${SOURCES} ${LAGOM_TOOL_SOURCES})
# alias for parity with exports
add_executable(Lagom::${tool} ALIAS ${tool})
target_link_libraries(${tool} LibCore ${LAGOM_TOOL_LIBS})
target_link_libraries(${tool} LibCore LibFileSystem ${LAGOM_TOOL_LIBS})
install(
TARGETS ${tool}
EXPORT LagomTargets

View file

@ -19,8 +19,8 @@
#include <AK/SourceGenerator.h>
#include <AK/StringBuilder.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
#include <LibFileSystem/FileSystem.h>
static DeprecatedString format_identifier(StringView owner, DeprecatedString identifier)
{
@ -913,7 +913,7 @@ static ErrorOr<void> parse_all_locales(DeprecatedString bcp47_path, DeprecatedSt
{
LexicalPath core_supplemental_path(core_path);
core_supplemental_path = core_supplemental_path.append("supplemental"sv);
VERIFY(Core::DeprecatedFile::is_directory(core_supplemental_path.string()));
VERIFY(FileSystem::is_directory(core_supplemental_path.string()));
TRY(parse_core_aliases(core_supplemental_path.string(), cldr));
TRY(parse_likely_subtags(core_supplemental_path.string(), cldr));

View file

@ -23,8 +23,8 @@
#include <AK/Traits.h>
#include <AK/Utf8View.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
#include <LibFileSystem/FileSystem.h>
#include <LibJS/Runtime/Intl/SingleUnitIdentifiers.h>
#include <LibLocale/Locale.h>
#include <LibLocale/NumberFormat.h>
@ -700,7 +700,7 @@ static ErrorOr<void> parse_all_locales(DeprecatedString core_path, DeprecatedStr
{
LexicalPath core_supplemental_path(move(core_path));
core_supplemental_path = core_supplemental_path.append("supplemental"sv);
VERIFY(Core::DeprecatedFile::is_directory(core_supplemental_path.string()));
VERIFY(FileSystem::is_directory(core_supplemental_path.string()));
TRY(parse_number_system_digits(core_supplemental_path.string(), cldr));

View file

@ -14,8 +14,8 @@
#include <AK/StringBuilder.h>
#include <AK/Variant.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
#include <LibFileSystem/FileSystem.h>
#include <LibLocale/PluralRules.h>
static DeprecatedString format_identifier(StringView owner, DeprecatedString identifier)
@ -396,7 +396,7 @@ static ErrorOr<void> parse_all_locales(DeprecatedString core_path, DeprecatedStr
{
LexicalPath core_supplemental_path(move(core_path));
core_supplemental_path = core_supplemental_path.append("supplemental"sv);
VERIFY(Core::DeprecatedFile::is_directory(core_supplemental_path.string()));
VERIFY(FileSystem::is_directory(core_supplemental_path.string()));
auto remove_variants_from_path = [&](DeprecatedString path) -> ErrorOr<DeprecatedString> {
auto parsed_locale = TRY(CanonicalLanguageID::parse(cldr.unique_strings, LexicalPath::basename(path)));

View file

@ -12,8 +12,8 @@
#include <AK/StringUtils.h>
#include <AK/Types.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
#include <LibFileSystem/FileSystem.h>
#include <LibUnicode/Emoji.h>
struct Emoji {
@ -47,7 +47,7 @@ static void set_image_path_for_emoji(StringView emoji_resource_path, EmojiData&
auto file = DeprecatedString::formatted("{}.png", builder.to_deprecated_string());
auto path = DeprecatedString::formatted("{}/{}", emoji_resource_path, file);
if (!Core::DeprecatedFile::exists(path))
if (!FileSystem::exists(path))
return;
emoji.image_path = emoji_data.unique_strings.ensure(move(file));
@ -396,7 +396,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.add_option(emoji_resource_path, "Path to the /res/emoji directory", "emoji-resource-path", 'r', "emoji-resource-path");
args_parser.parse(arguments);
VERIFY(!emoji_resource_path.is_empty() && Core::DeprecatedFile::exists(emoji_resource_path));
VERIFY(!emoji_resource_path.is_empty() && FileSystem::exists(emoji_resource_path));
auto emoji_test_file = TRY(open_file(emoji_test_path, Core::File::OpenMode::Read));

View file

@ -13,6 +13,7 @@
#include <AK/Vector.h>
#include <LibCore/ConfigFile.h>
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.h>
#include <spawn.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
@ -241,7 +242,7 @@ int main()
return 1;
}
if (!Core::DeprecatedFile::exists("components.ini"sv)) {
if (!FileSystem::exists("components.ini"sv)) {
warnln("\e[31mError:\e[0m There is no 'components.ini' in the current working directory.");
warnln(" It can be generated by running CMake with 'cmake ../.. -G Ninja'");
return 1;

View file

@ -27,6 +27,6 @@ serenity_component(
TARGETS test-test262
)
add_executable(test-test262 test-test262.cpp)
target_link_libraries(test-test262 PRIVATE LibMain LibCore)
target_link_libraries(test-test262 PRIVATE LibMain LibCore LibFileSystem)
serenity_set_implicit_links(test-test262)
install(TARGETS test-test262 RUNTIME DESTINATION bin OPTIONAL)

View file

@ -13,10 +13,10 @@
#include <AK/QuickSort.h>
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/File.h>
#include <LibCore/Process.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
#include <LibMain/Main.h>
#include <LibTest/TestRunnerUtil.h>
#include <spawn.h>
@ -322,7 +322,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
// Normalize the path to ensure filenames are consistent
Vector<DeprecatedString> paths;
if (!Core::DeprecatedFile::is_directory(test_directory)) {
if (!FileSystem::is_directory(test_directory)) {
paths.append(test_directory);
} else {
Test::iterate_directory_recursively(LexicalPath::canonicalized_path(test_directory), [&](DeprecatedString const& file_path) {

View file

@ -6,10 +6,10 @@
#include <AK/Base64.h>
#include <LibCore/ConfigFile.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
#include <LibCrypto/ASN1/ASN1.h>
#include <LibCrypto/ASN1/PEM.h>
#include <LibFileSystem/FileSystem.h>
#include <LibTLS/TLSv12.h>
#include <LibTest/TestCase.h>
@ -28,11 +28,11 @@ DeprecatedString locate_ca_certs_file();
DeprecatedString locate_ca_certs_file()
{
if (Core::DeprecatedFile::exists(ca_certs_file)) {
if (FileSystem::exists(ca_certs_file)) {
return ca_certs_file;
}
auto on_target_path = DeprecatedString("/etc/cacert.pem");
if (Core::DeprecatedFile::exists(on_target_path)) {
if (FileSystem::exists(on_target_path)) {
return on_target_path;
}
return "";

View file

@ -41,5 +41,5 @@ set(GENERATED_SOURCES
)
serenity_app(Browser ICON app-browser)
target_link_libraries(Browser PRIVATE LibCore LibWebView LibWeb LibProtocol LibGUI LibDesktop LibConfig LibGfx LibIPC LibJS LibLocale LibMain LibSyntax LibSQL)
target_link_libraries(Browser PRIVATE LibCore LibFileSystem LibWebView LibWeb LibProtocol LibGUI LibDesktop LibConfig LibGfx LibIPC LibJS LibLocale LibMain LibSyntax LibSQL)
link_with_locale_data(Browser)

View file

@ -19,6 +19,7 @@
#include <LibCore/StandardPaths.h>
#include <LibCore/System.h>
#include <LibDesktop/Launcher.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Icon.h>
@ -131,7 +132,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
auto url_from_argument_string = [](DeprecatedString const& string) -> URL {
if (Core::DeprecatedFile::exists(string)) {
if (FileSystem::exists(string)) {
return URL::create_with_file_scheme(Core::DeprecatedFile::real_path_for(string));
}
return Browser::url_from_user_input(string);

View file

@ -16,4 +16,4 @@ set(GENERATED_SOURCES
)
serenity_app(CrashReporter ICON app-crash-reporter)
target_link_libraries(CrashReporter PRIVATE LibCore LibCoredump LibDebug LibDesktop LibFileSystemAccessClient LibGfx LibGUI LibMain LibThreading)
target_link_libraries(CrashReporter PRIVATE LibCore LibCoredump LibDebug LibDesktop LibFileSystem LibFileSystemAccessClient LibGfx LibGUI LibMain LibThreading)

View file

@ -12,13 +12,13 @@
#include <AK/URL.h>
#include <Applications/CrashReporter/CrashReporterWindowGML.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibCoredump/Backtrace.h>
#include <LibCoredump/Reader.h>
#include <LibDesktop/AppFile.h>
#include <LibDesktop/Launcher.h>
#include <LibELF/Core.h>
#include <LibFileSystem/FileSystem.h>
#include <LibFileSystemAccessClient/Client.h>
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>
@ -131,7 +131,7 @@ static TitleAndText build_cpu_registers(const ELF::Core::ThreadInfo& thread_info
static void unlink_coredump(StringView coredump_path)
{
if (Core::DeprecatedFile::remove(coredump_path, Core::DeprecatedFile::RecursionMode::Disallowed).is_error())
if (FileSystem::remove(coredump_path, FileSystem::RecursionMode::Disallowed).is_error())
dbgln("Failed deleting coredump file");
}

View file

@ -25,4 +25,4 @@ set(GENERATED_SOURCES
)
serenity_app(FileManager ICON app-file-manager)
target_link_libraries(FileManager PRIVATE LibCore LibGfx LibGUI LibDesktop LibConfig LibMain LibThreading)
target_link_libraries(FileManager PRIVATE LibCore LibFileSystem LibGfx LibGUI LibDesktop LibConfig LibMain LibThreading)

View file

@ -14,6 +14,7 @@
#include <LibCore/DeprecatedFile.h>
#include <LibCore/MimeData.h>
#include <LibCore/StandardPaths.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGUI/FileIconProvider.h>
#include <LibGUI/InputBox.h>
#include <LibGUI/Label.h>
@ -204,7 +205,7 @@ void DirectoryView::setup_model()
while (model_root.string() != "/") {
model_root = model_root.parent();
if (Core::DeprecatedFile::is_directory(model_root.string()))
if (FileSystem::is_directory(model_root.string()))
break;
}
@ -406,7 +407,7 @@ void DirectoryView::add_path_to_history(DeprecatedString path)
bool DirectoryView::open(DeprecatedString const& path)
{
auto real_path = Core::DeprecatedFile::real_path_for(path);
if (real_path.is_null() || !Core::DeprecatedFile::is_directory(path))
if (real_path.is_null() || !FileSystem::is_directory(path))
return false;
if (chdir(real_path.characters()) < 0) {
@ -555,7 +556,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::DeprecatedFile::can_delete_or_move(node(index).full_path());
return FileSystem::can_delete_or_move(node(index).full_path());
}).has_value();
// clang-format on
}

View file

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

View file

@ -14,6 +14,7 @@
#include <LibCore/Directory.h>
#include <LibCore/System.h>
#include <LibDesktop/Launcher.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/CheckBox.h>
#include <LibGUI/FileIconProvider.h>
@ -212,7 +213,7 @@ bool PropertiesWindow::apply_changes()
DeprecatedString new_name = m_name_box->text();
DeprecatedString new_file = make_full_path(new_name).characters();
if (Core::DeprecatedFile::exists(new_file)) {
if (FileSystem::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

@ -25,6 +25,7 @@
#include <LibCore/System.h>
#include <LibCore/TempFile.h>
#include <LibDesktop/Launcher.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGUI/Action.h>
#include <LibGUI/ActionGroup.h>
#include <LibGUI/Application.h>
@ -111,7 +112,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (!ignore_path_resolution)
initial_location = Core::DeprecatedFile::real_path_for(initial_location);
if (!Core::DeprecatedFile::is_directory(initial_location)) {
if (!FileSystem::is_directory(initial_location)) {
// We want to extract zips to a temporary directory when FileManager is launched with a .zip file as its first argument
if (path.has_extension(".zip"sv)) {
auto temp_directory = Core::TempFile::create_temp_directory();
@ -215,7 +216,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::DeprecatedFile::link_file(destination, path); result.is_error()) {
if (auto result = FileSystem::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);
}
@ -483,7 +484,7 @@ ErrorOr<int> run_in_desktop_mode()
}
for (auto& path : paths) {
if (Core::DeprecatedFile::is_directory(path))
if (FileSystem::is_directory(path))
Desktop::Launcher::open(URL::create_with_file_scheme(path));
}
});
@ -496,7 +497,7 @@ ErrorOr<int> run_in_desktop_mode()
}
for (auto& path : paths) {
if (Core::DeprecatedFile::is_directory(path)) {
if (FileSystem::is_directory(path)) {
spawn_terminal(path);
}
}
@ -821,7 +822,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
paths = directory_view->selected_file_paths();
for (auto& path : paths) {
if (Core::DeprecatedFile::is_directory(path))
if (FileSystem::is_directory(path))
Desktop::Launcher::open(URL::create_with_file_scheme(path));
}
},
@ -840,7 +841,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
paths = directory_view->selected_file_paths();
for (auto& path : paths) {
if (Core::DeprecatedFile::is_directory(path)) {
if (FileSystem::is_directory(path)) {
spawn_terminal(path);
}
}
@ -1092,7 +1093,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
(void)TRY(main_toolbar.try_add_action(directory_view->view_as_columns_action()));
breadcrumbbar.on_path_change = [&](auto selected_path) {
if (Core::DeprecatedFile::is_directory(selected_path)) {
if (FileSystem::is_directory(selected_path)) {
directory_view->open(selected_path);
} else {
dbgln("Breadcrumb path '{}' doesn't exist", selected_path);

View file

@ -15,4 +15,4 @@ set(GENERATED_SOURCES
)
serenity_app(PartitionEditor ICON app-partition-editor)
target_link_libraries(PartitionEditor PRIVATE LibCore LibGfx LibMain LibGUI LibPartition)
target_link_libraries(PartitionEditor PRIVATE LibCore LibFileSystem LibGfx LibMain LibGUI LibPartition)

View file

@ -13,6 +13,11 @@
namespace PartitionEditor {
NonnullRefPtr<PartitionModel> PartitionModel::create()
{
return adopt_ref(*new PartitionModel);
}
DeprecatedString PartitionModel::column_name(int column) const
{
switch (column) {

View file

@ -22,7 +22,7 @@ public:
__Count,
};
static NonnullRefPtr<PartitionModel> create() { return adopt_ref(*new PartitionModel()); }
static NonnullRefPtr<PartitionModel> create();
virtual ~PartitionModel() override = default;
virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return m_partition_table->partitions_count(); }

View file

@ -6,9 +6,9 @@
#include <Applications/PartitionEditor/PartitionEditorWindowGML.h>
#include <Applications/PartitionEditor/PartitionModel.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGUI/Application.h>
#include <LibGUI/ComboBox.h>
#include <LibGUI/ItemListModel.h>
@ -23,7 +23,7 @@ static Vector<DeprecatedString> get_device_paths()
// FIXME: Propagate errors.
(void)Core::Directory::for_each_entry("/dev"sv, Core::DirIterator::Flags::SkipParentAndBaseDir, [&](auto const& entry, auto const& directory) -> ErrorOr<IterationDecision> {
auto full_path = LexicalPath::join(directory.path().string(), entry.name).string();
if (Core::DeprecatedFile::is_block_device(full_path))
if (FileSystem::is_block_device(full_path))
device_paths.append(full_path);
return IterationDecision::Continue;
});

View file

@ -8,7 +8,7 @@
#include "AlbumCoverVisualizationWidget.h"
#include <AK/LexicalPath.h>
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.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::DeprecatedFile::exists(cover_path.string()))
if (FileSystem::exists(cover_path.string()))
return Gfx::Bitmap::load_from_file(cover_path.string());
}

View file

@ -19,4 +19,4 @@ set(SOURCES
)
serenity_app(SoundPlayer ICON app-sound-player)
target_link_libraries(SoundPlayer PRIVATE LibAudio LibConfig LibCore LibDSP LibGfx LibGUI LibIPC LibMain LibThreading LibImageDecoderClient)
target_link_libraries(SoundPlayer PRIVATE LibAudio LibConfig LibCore LibFileSystem LibDSP LibGfx LibGUI LibIPC LibMain LibThreading LibImageDecoderClient)

View file

@ -7,7 +7,7 @@
#include "Player.h"
#include <LibAudio/FlacLoader.h>
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.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::DeprecatedFile::exists(path)) {
if (!FileSystem::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/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.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::DeprecatedFile::size(entry.path);
auto size = FileSystem::size(entry.path);
if (size.is_error())
continue;
entry.extended_info->file_size_in_bytes = size.value();
} else if (!Core::DeprecatedFile::exists(entry.path)) {
} else if (!FileSystem::exists(entry.path)) {
to_delete.append(&entry);
continue;
}

View file

@ -17,4 +17,4 @@ set(GENERATED_SOURCES
)
serenity_app(SpaceAnalyzer ICON app-space-analyzer)
target_link_libraries(SpaceAnalyzer PRIVATE LibCore LibDesktop LibGfx LibGUI LibIPC LibMain)
target_link_libraries(SpaceAnalyzer PRIVATE LibCore LibDesktop LibFileSystem LibGfx LibGUI LibIPC LibMain)

View file

@ -11,8 +11,8 @@
#include <AK/String.h>
#include <AK/URL.h>
#include <Applications/SpaceAnalyzer/SpaceAnalyzerGML.h>
#include <LibCore/DeprecatedFile.h>
#include <LibDesktop/Launcher.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Breadcrumbbar.h>
@ -84,7 +84,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (path_string.is_empty())
return;
if (Core::DeprecatedFile::is_directory(path_string)) {
if (FileSystem::is_directory(path_string)) {
Desktop::Launcher::open(URL::create_with_file_scheme(path_string));
return;
}
@ -102,7 +102,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
while (try_again) {
try_again = false;
auto deletion_result = Core::DeprecatedFile::remove(selected_node_path, Core::DeprecatedFile::RecursionMode::Allowed);
auto deletion_result = FileSystem::remove(selected_node_path, FileSystem::RecursionMode::Allowed);
if (deletion_result.is_error()) {
auto retry_message_result = GUI::MessageBox::show(window,
DeprecatedString::formatted("Failed to delete \"{}\": {}. Retry?",
@ -168,8 +168,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::DeprecatedFile::can_delete_or_move(selected_node_path));
if (Core::DeprecatedFile::is_directory(selected_node_path))
delete_action->set_enabled(FileSystem::can_delete_or_move(selected_node_path));
if (FileSystem::is_directory(selected_node_path))
open_action->set_text("Open in File Manager");
else
open_action->set_text("Reveal in File Manager");

View file

@ -42,7 +42,7 @@ set(GENERATED_SOURCES
)
serenity_app(Spreadsheet ICON app-spreadsheet)
target_link_libraries(Spreadsheet PRIVATE LibCore LibFileSystemAccessClient LibGfx LibGUI LibJS LibMain LibMarkdown LibSyntax LibWebView LibWeb)
target_link_libraries(Spreadsheet PRIVATE LibCore LibFileSystem LibFileSystemAccessClient LibGfx LibGUI LibJS LibMain LibMarkdown LibSyntax LibWebView LibWeb)
serenity_test(Writers/Test/TestXSVWriter.cpp Spreadsheet)

View file

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

View file

@ -28,4 +28,4 @@ set(GENERATED_SOURCES
)
serenity_app(ThemeEditor ICON app-theme-editor)
target_link_libraries(ThemeEditor PRIVATE LibCore LibGfx LibGUI LibFileSystemAccessClient LibIPC LibMain)
target_link_libraries(ThemeEditor PRIVATE LibCore LibGfx LibGUI LibFileSystem LibFileSystemAccessClient LibIPC LibMain)

View file

@ -15,7 +15,7 @@
#include <Applications/ThemeEditor/MetricPropertyGML.h>
#include <Applications/ThemeEditor/PathPropertyGML.h>
#include <Applications/ThemeEditor/ThemeEditorGML.h>
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.h>
#include <LibFileSystemAccessClient/Client.h>
#include <LibGUI/ActionGroup.h>
#include <LibGUI/BoxLayout.h>
@ -591,8 +591,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::DeprecatedFile::exists(target_path)) {
if (!Core::DeprecatedFile::is_directory(target_path))
if (FileSystem::exists(target_path)) {
if (!FileSystem::is_directory(target_path))
target_path = LexicalPath::dirname(target_path);
} else {
target_path = "/res/icons";

View file

@ -41,7 +41,7 @@ set(utility_srcs
serenity_bin(BuggieBox)
target_sources(BuggieBox PRIVATE main.cpp)
target_link_libraries(BuggieBox PRIVATE LibMain LibShell LibCompress LibCore LibCrypto LibGfx LibLine LibRegex LibAudio)
target_link_libraries(BuggieBox PRIVATE LibMain LibShell LibCompress LibCore LibCrypto LibFileSystem LibGfx LibLine LibRegex LibAudio)
foreach(file IN LISTS utility_srcs)
buggiebox_utility(${file})

View file

@ -54,5 +54,5 @@ set(GENERATED_SOURCES
)
serenity_app(HackStudio ICON app-hack-studio)
target_link_libraries(HackStudio PRIVATE LibWebView LibWeb LibMarkdown LibGUI LibCpp LibCMake LibGfx LibCore LibVT LibDebug LibX86 LibDiff LibShell LibSymbolication LibSyntax LibRegex LibSQL LibConfig LibCore LibCoredump LibDesktop LibIPC LibJS LibMain LibThreading)
target_link_libraries(HackStudio PRIVATE LibWebView LibWeb LibMarkdown LibGUI LibCpp LibCMake LibGfx LibCore LibVT LibDebug LibX86 LibDiff LibShell LibSymbolication LibSyntax LibRegex LibSQL LibConfig LibCore LibCoredump LibDesktop LibFileSystem LibIPC LibJS LibMain LibThreading)
add_dependencies(HackStudio CppLanguageServer)

View file

@ -12,8 +12,8 @@
#include <AK/DeprecatedString.h>
#include <AK/LexicalPath.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
#include <LibGUI/FilePicker.h>
@ -150,7 +150,7 @@ Optional<DeprecatedString> NewProjectDialog::get_available_project_name()
? chosen_name
: DeprecatedString::formatted("{}-{}", chosen_name, i);
if (!Core::DeprecatedFile::exists(DeprecatedString::formatted("{}/{}", create_in, candidate)))
if (!FileSystem::exists(DeprecatedString::formatted("{}/{}", create_in, candidate)))
return candidate;
}
@ -188,7 +188,7 @@ void NewProjectDialog::do_create_project()
}
auto create_in = m_create_in_input->text();
if (!Core::DeprecatedFile::exists(create_in) || !Core::DeprecatedFile::is_directory(create_in)) {
if (!FileSystem::exists(create_in) || !FileSystem::is_directory(create_in)) {
auto result = GUI::MessageBox::show(this, DeprecatedString::formatted("The directory {} does not exist yet, would you like to create it?", create_in), "New project"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
if (result != GUI::MessageBox::ExecResult::Yes)
return;

View file

@ -16,11 +16,11 @@
#include <LibCMake/CMakeCache/SyntaxHighlighter.h>
#include <LibCMake/SyntaxHighlighter.h>
#include <LibConfig/Client.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/Timer.h>
#include <LibCpp/SemanticSyntaxHighlighter.h>
#include <LibCpp/SyntaxHighlighter.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/GML/AutocompleteProvider.h>
@ -424,7 +424,7 @@ static HashMap<DeprecatedString, DeprecatedString>& include_paths()
Core::DirIterator it(recursive.value_or(base), Core::DirIterator::Flags::SkipDots);
while (it.has_next()) {
auto path = it.next_full_path();
if (!Core::DeprecatedFile::is_directory(path)) {
if (!FileSystem::is_directory(path)) {
auto key = path.substring(base.length() + 1, path.length() - base.length() - 1);
dbgln_if(EDITOR_DEBUG, "Adding header \"{}\" in path \"{}\"", key, path);
paths.set(key, path);

View file

@ -34,6 +34,7 @@
#include <LibCore/System.h>
#include <LibDebug/DebugSession.h>
#include <LibDesktop/Launcher.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGUI/Action.h>
#include <LibGUI/ActionGroup.h>
#include <LibGUI/Application.h>
@ -311,7 +312,7 @@ bool HackStudioWidget::open_file(DeprecatedString const& full_filename, size_t l
if (full_filename.starts_with(project().root_path())) {
filename = LexicalPath::relative_path(full_filename, project().root_path());
}
if (Core::DeprecatedFile::is_directory(filename) || !Core::DeprecatedFile::exists(filename))
if (FileSystem::is_directory(filename) || !FileSystem::exists(filename))
return false;
auto editor_wrapper_or_none = m_all_editor_wrappers.first_matching([&](auto& wrapper) {
@ -533,13 +534,13 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_new_file_action(Dep
DeprecatedString filepath;
if (!path_to_selected.is_empty()) {
VERIFY(Core::DeprecatedFile::exists(path_to_selected.first()));
VERIFY(FileSystem::exists(path_to_selected.first()));
LexicalPath selected(path_to_selected.first());
DeprecatedString dir_path;
if (Core::DeprecatedFile::is_directory(selected.string()))
if (FileSystem::is_directory(selected.string()))
dir_path = selected.string();
else
dir_path = selected.dirname();
@ -573,7 +574,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_new_directory_actio
DeprecatedString dir_path;
if (Core::DeprecatedFile::is_directory(selected.string()))
if (FileSystem::is_directory(selected.string()))
dir_path = selected.string();
else
dir_path = selected.dirname();
@ -681,7 +682,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_delete_action()
}
bool is_directory = S_ISDIR(st.st_mode);
if (auto result = Core::DeprecatedFile::remove(file, Core::DeprecatedFile::RecursionMode::Allowed); result.is_error()) {
if (auto result = FileSystem::remove(file, FileSystem::RecursionMode::Allowed); result.is_error()) {
auto& error = result.error();
if (is_directory) {
GUI::MessageBox::show(window(),
@ -1001,7 +1002,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_debug_action()
{
auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-run.png"sv));
return GUI::Action::create("&Debug", icon, [this](auto&) {
if (!Core::DeprecatedFile::exists(get_project_executable_path())) {
if (!FileSystem::exists(get_project_executable_path())) {
GUI::MessageBox::show(window(), DeprecatedString::formatted("Could not find file: {}. (did you build the project?)", get_project_executable_path()), "Error"sv, GUI::MessageBox::Type::Error);
return;
}
@ -1249,7 +1250,7 @@ void HackStudioWidget::configure_project_tree_view()
auto selections = m_project_tree_view->selection().indices();
auto it = selections.find_if([&](auto selected_file) {
return Core::DeprecatedFile::can_delete_or_move(m_project->model().full_path(selected_file));
return FileSystem::can_delete_or_move(m_project->model().full_path(selected_file));
});
bool has_permissions = it != selections.end();
m_tree_view_rename_action->set_enabled(has_permissions);
@ -1794,10 +1795,10 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_open_project_config
DeprecatedString formatted_error_string_holder;
auto save_configuration_or_error = [&]() -> ErrorOr<void> {
if (Core::DeprecatedFile::exists(absolute_config_file_path))
if (FileSystem::exists(absolute_config_file_path))
return {};
if (Core::DeprecatedFile::exists(parent_directory) && !Core::DeprecatedFile::is_directory(parent_directory)) {
if (FileSystem::exists(parent_directory) && !FileSystem::is_directory(parent_directory)) {
formatted_error_string_holder = DeprecatedString::formatted("Cannot create the '{}' directory because there is already a file with that name", parent_directory);
return Error::from_string_view(formatted_error_string_holder);
}

View file

@ -6,7 +6,7 @@
#include "Project.h"
#include "HackStudio.h"
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.h>
namespace HackStudio {
@ -18,7 +18,7 @@ Project::Project(DeprecatedString const& root_path)
OwnPtr<Project> Project::open_with_root_path(DeprecatedString const& root_path)
{
if (!Core::DeprecatedFile::is_directory(root_path))
if (!FileSystem::is_directory(root_path))
return {};
return adopt_own(*new Project(root_path));
}

View file

@ -7,7 +7,7 @@
#include "ProjectBuilder.h"
#include <AK/LexicalPath.h>
#include <LibCore/Command.h>
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.h>
#include <LibRegex/Regex.h>
#include <fcntl.h>
#include <sys/stat.h>
@ -124,15 +124,15 @@ ErrorOr<DeprecatedString> ProjectBuilder::component_name(StringView cmake_file_p
ErrorOr<void> ProjectBuilder::initialize_build_directory()
{
if (!Core::DeprecatedFile::exists(build_directory())) {
if (!FileSystem::exists(build_directory())) {
if (mkdir(LexicalPath::join(build_directory()).string().characters(), 0700)) {
return Error::from_errno(errno);
}
}
auto cmake_file_path = LexicalPath::join(build_directory(), "CMakeLists.txt"sv).string();
if (Core::DeprecatedFile::exists(cmake_file_path))
MUST(Core::DeprecatedFile::remove(cmake_file_path, Core::DeprecatedFile::RecursionMode::Disallowed));
if (FileSystem::exists(cmake_file_path))
MUST(FileSystem::remove(cmake_file_path, FileSystem::RecursionMode::Disallowed));
auto cmake_file = TRY(Core::File::open(cmake_file_path, Core::File::OpenMode::Write));
TRY(cmake_file->write_until_depleted(generate_cmake_file_content().bytes()));
@ -150,7 +150,7 @@ Optional<DeprecatedString> ProjectBuilder::find_cmake_file_for(StringView file_p
auto directory = LexicalPath::dirname(file_path);
while (!directory.is_empty()) {
auto cmake_path = LexicalPath::join(m_project_root, directory, "CMakeLists.txt"sv);
if (Core::DeprecatedFile::exists(cmake_path.string()))
if (FileSystem::exists(cmake_path.string()))
return cmake_path.string();
directory = LexicalPath::dirname(directory);
}

View file

@ -11,6 +11,7 @@
#include <LibCore/ConfigFile.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibFileSystem/FileSystem.h>
#include <fcntl.h>
#include <spawn.h>
#include <sys/stat.h>
@ -52,7 +53,7 @@ RefPtr<ProjectTemplate> ProjectTemplate::load_from_manifest(DeprecatedString con
auto bitmap_path_32 = DeprecatedString::formatted("/res/icons/hackstudio/templates-32x32/{}.png", config->read_entry("HackStudioTemplate", "IconName32x"));
if (Core::DeprecatedFile::exists(bitmap_path_32)) {
if (FileSystem::exists(bitmap_path_32)) {
auto bitmap_or_error = Gfx::Bitmap::load_from_file(bitmap_path_32);
if (!bitmap_or_error.is_error())
icon = GUI::Icon(bitmap_or_error.release_value());
@ -64,14 +65,14 @@ RefPtr<ProjectTemplate> ProjectTemplate::load_from_manifest(DeprecatedString con
Result<void, DeprecatedString> ProjectTemplate::create_project(DeprecatedString const& name, DeprecatedString const& path)
{
// Check if a file or directory already exists at the project path
if (Core::DeprecatedFile::exists(path))
if (FileSystem::exists(path))
return DeprecatedString("File or directory already exists at specified location.");
dbgln("Creating project at path '{}' with name '{}'", path, name);
// Verify that the template content directory exists. If it does, copy it's contents.
// Otherwise, create an empty directory at the project path.
if (Core::DeprecatedFile::is_directory(content_path())) {
if (FileSystem::is_directory(content_path())) {
auto result = Core::DeprecatedFile::copy_file_or_directory(path, content_path());
dbgln("Copying {} -> {}", content_path(), path);
if (result.is_error())

View file

@ -13,6 +13,7 @@
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGUI/Application.h>
#include <LibGUI/Menubar.h>
#include <LibGUI/MessageBox.h>
@ -140,7 +141,7 @@ static Optional<DeprecatedString> last_opened_project_path()
if (projects.size() == 0)
return {};
if (!Core::DeprecatedFile::exists(projects[0]))
if (!FileSystem::exists(projects[0]))
return {};
return { projects[0] };

View file

@ -24,4 +24,4 @@ set(SOURCES
)
serenity_app(Profiler ICON app-profiler)
target_link_libraries(Profiler PRIVATE LibCore LibDebug LibGfx LibGUI LibDesktop LibX86 LibSymbolication LibMain)
target_link_libraries(Profiler PRIVATE LibCore LibDebug LibFileSystem LibGfx LibGUI LibDesktop LibX86 LibSymbolication LibMain)

View file

@ -5,7 +5,7 @@
*/
#include "Process.h"
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.h>
namespace Profiler {
@ -93,7 +93,7 @@ void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, DeprecatedString co
DeprecatedString full_path;
if (path_string.starts_with('/'))
full_path = path_string;
else if (Core::DeprecatedFile::looks_like_shared_library(path_string))
else if (FileSystem::looks_like_shared_library(path_string))
full_path = DeprecatedString::formatted("/usr/lib/{}", path);
else
full_path = path_string;

View file

@ -17,4 +17,4 @@ set(GENERATED_SOURCES
)
serenity_app(SQLStudio ICON app-sql-studio)
target_link_libraries(SQLStudio PRIVATE LibCore LibDesktop LibGfx LibGUI LibIPC LibMain LibSQL LibSyntax)
target_link_libraries(SQLStudio PRIVATE LibCore LibDesktop LibFileSystem LibGfx LibGUI LibIPC LibMain LibSQL LibSyntax)

View file

@ -6,10 +6,10 @@
*/
#include <DevTools/SQLStudio/SQLStudioGML.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/StandardPaths.h>
#include <LibDesktop/Launcher.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>
@ -45,7 +45,7 @@ static Vector<DeprecatedString> lookup_database_names()
static constexpr auto database_extension = ".db"sv;
auto database_path = DeprecatedString::formatted("{}/sql", Core::StandardPaths::data_directory());
if (!Core::DeprecatedFile::exists(database_path))
if (!FileSystem::exists(database_path))
return {};
Core::DirIterator iterator(move(database_path), Core::DirIterator::SkipParentAndBaseDir);

View file

@ -23,4 +23,4 @@ set(SOURCES
add_compile_options(-mmmx -Wno-psabi -frounding-math)
serenity_bin(UserspaceEmulator)
target_link_libraries(UserspaceEmulator PRIVATE LibX86 LibDebug LibCore LibLine LibSystem)
target_link_libraries(UserspaceEmulator PRIVATE LibX86 LibDebug LibCore LibFileSystem LibLine LibSystem)

View file

@ -17,6 +17,7 @@
#include <LibELF/AuxiliaryVector.h>
#include <LibELF/Image.h>
#include <LibELF/Validation.h>
#include <LibFileSystem/FileSystem.h>
#include <LibX86/ELFSymbolProvider.h>
#include <fcntl.h>
#include <syscall.h>
@ -423,7 +424,7 @@ MmapRegion const* Emulator::load_library_from_address(FlatPtr address)
return {};
DeprecatedString lib_path = lib_name;
if (Core::DeprecatedFile::looks_like_shared_library(lib_name))
if (FileSystem::looks_like_shared_library(lib_name))
lib_path = DeprecatedString::formatted("/usr/lib/{}", lib_path);
if (!m_dynamic_library_cache.contains(lib_path)) {
@ -461,7 +462,7 @@ Optional<Emulator::SymbolInfo> Emulator::symbol_at(FlatPtr address)
auto const* first_region = (lib_name.is_null() || lib_name.is_empty()) ? address_region : first_region_for_object(lib_name);
VERIFY(first_region);
auto lib_path = lib_name;
if (Core::DeprecatedFile::looks_like_shared_library(lib_name)) {
if (FileSystem::looks_like_shared_library(lib_name)) {
lib_path = DeprecatedString::formatted("/usr/lib/{}", lib_name);
}

View file

@ -19,4 +19,4 @@ set(GENERATED_SOURCES
)
serenity_app(Snake ICON app-snake)
target_link_libraries(Snake PRIVATE LibCore LibGfx LibGUI LibConfig LibMain LibDesktop)
target_link_libraries(Snake PRIVATE LibCore LibFileSystem LibGfx LibGUI LibConfig LibMain LibDesktop)

View file

@ -8,7 +8,7 @@
#include "ClassicSkin.h"
#include "ImageSkin.h"
#include <AK/String.h>
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.h>
namespace Snake {
@ -18,7 +18,7 @@ ErrorOr<NonnullOwnPtr<SnakeSkin>> SnakeSkin::create(StringView skin_name, Color
return try_make<ClassicSkin>(color);
// Try to find an image-based skin matching the name.
if (Core::DeprecatedFile::exists(TRY(String::formatted("/res/graphics/snake/skins/{}", skin_name))))
if (FileSystem::exists(TRY(String::formatted("/res/graphics/snake/skins/{}", skin_name))))
return ImageSkin::create(skin_name);
// Fall-back on classic

View file

@ -17,4 +17,4 @@ set(SOURCES
serenity_bin(CppComprehensionTests)
target_link_libraries(CppComprehensionTests PRIVATE LibCodeComprehension LibCore LibCpp LibRegex LibMain)
target_link_libraries(CppComprehensionTests PRIVATE LibCodeComprehension LibCore LibCpp LibFileSystem LibRegex LibMain)

View file

@ -9,12 +9,12 @@
#include <AK/HashTable.h>
#include <AK/OwnPtr.h>
#include <AK/ScopeGuard.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCpp/AST.h>
#include <LibCpp/Lexer.h>
#include <LibCpp/Parser.h>
#include <LibCpp/Preprocessor.h>
#include <LibFileSystem/FileSystem.h>
#include <LibRegex/Regex.h>
#include <Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.h>
@ -736,7 +736,7 @@ Optional<Vector<CodeComprehension::AutocompleteResultEntry>> CppComprehensionEng
if (!path.starts_with(partial_basename))
continue;
if (Core::DeprecatedFile::is_directory(LexicalPath::join(full_dir, path).string())) {
if (FileSystem::is_directory(LexicalPath::join(full_dir, path).string())) {
// FIXME: Don't dismiss the autocomplete when filling these suggestions.
auto completion = DeprecatedString::formatted("{}{}{}/", prefix, include_dir, path);
options.empend(completion, include_dir.length() + partial_basename.length() + 1, CodeComprehension::Language::Cpp, path, CodeComprehension::AutocompleteResultEntry::HideAutocompleteAfterApplying::No);

View file

@ -9,12 +9,12 @@
#include <AK/Platform.h>
#include <AK/StringBuilder.h>
#include <AK/Types.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/MappedFile.h>
#include <LibCoredump/Backtrace.h>
#include <LibCoredump/Reader.h>
#include <LibELF/Core.h>
#include <LibELF/Image.h>
#include <LibFileSystem/FileSystem.h>
namespace Coredump {
@ -26,7 +26,7 @@ ELFObjectInfo const* Backtrace::object_info_for_region(Reader const& coredump, M
if (maybe_ptr.has_value())
return *maybe_ptr;
if (!Core::DeprecatedFile::exists(path))
if (!FileSystem::exists(path))
return nullptr;
auto file_or_error = Core::MappedFile::map(path);

View file

@ -5,4 +5,4 @@ set(SOURCES
)
serenity_lib(LibCoredump coredump)
target_link_libraries(LibCoredump PRIVATE LibCompress LibCore LibDebug)
target_link_libraries(LibCoredump PRIVATE LibCompress LibCore LibDebug LibFileSystem)

View file

@ -6,13 +6,14 @@
*/
#include <AK/ByteReader.h>
#include <AK/Function.h>
#include <AK/HashTable.h>
#include <AK/JsonObject.h>
#include <AK/JsonValue.h>
#include <AK/LexicalPath.h>
#include <LibCompress/Gzip.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCoredump/Reader.h>
#include <LibFileSystem/FileSystem.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
@ -297,7 +298,7 @@ DeprecatedString Reader::resolve_object_path(StringView name) const
// (e.g. UserspaceEmulator, LibSymbolication, Profiler, and DynamicLinker itself)
// We should consider creating unified implementation in the future.
if (name.starts_with('/') || !Core::DeprecatedFile::looks_like_shared_library(name)) {
if (name.starts_with('/') || !FileSystem::looks_like_shared_library(name)) {
return name;
}

View file

@ -14,4 +14,4 @@ set(SOURCES
)
serenity_lib(LibDebug debug)
target_link_libraries(LibDebug PRIVATE LibCore LibRegex)
target_link_libraries(LibDebug PRIVATE LibCore LibFileSystem LibRegex)

View file

@ -11,6 +11,7 @@
#include <AK/Optional.h>
#include <AK/Platform.h>
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.h>
#include <LibRegex/Regex.h>
#include <stdlib.h>
#include <sys/mman.h>
@ -487,7 +488,7 @@ void DebugSession::update_loaded_libs()
return IterationDecision::Continue;
DeprecatedString lib_name = object_path.value();
if (Core::DeprecatedFile::looks_like_shared_library(lib_name))
if (FileSystem::looks_like_shared_library(lib_name))
lib_name = LexicalPath::basename(object_path.value());
FlatPtr base_address = entry.as_object().get_addr("address"sv).value_or(0);

View file

@ -8,5 +8,5 @@ set(GENERATED_SOURCES
)
serenity_lib(LibFileSystemAccessClient filesystemaccessclient)
target_link_libraries(LibFileSystemAccessClient PRIVATE LibCore LibIPC)
target_link_libraries(LibFileSystemAccessClient PRIVATE LibCore LibFileSystem LibIPC)
add_dependencies(LibFileSystemAccessClient WindowServer)

View file

@ -7,6 +7,7 @@
#include <AK/LexicalPath.h>
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.h>
#include <LibFileSystemAccessClient/Client.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/MessageBox.h>
@ -128,13 +129,13 @@ void Client::handle_prompt_end(i32 request_id, i32 error, Optional<IPC::File> co
return;
}
if (Core::DeprecatedFile::is_device(ipc_file->fd())) {
if (FileSystem::is_device(*chosen_file)) {
GUI::MessageBox::show_error(request_data.parent_window, DeprecatedString::formatted("Opening \"{}\" failed: Cannot open device files", *chosen_file));
request_data.promise->resolve(Error::from_string_literal("Cannot open device files")).release_value_but_fixme_should_propagate_errors();
return;
}
if (Core::DeprecatedFile::is_directory(ipc_file->fd())) {
if (FileSystem::is_directory(*chosen_file)) {
GUI::MessageBox::show_error(request_data.parent_window, DeprecatedString::formatted("Opening \"{}\" failed: Cannot open directory", *chosen_file));
request_data.promise->resolve(Error::from_errno(EISDIR)).release_value_but_fixme_should_propagate_errors();
return;

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 {

View file

@ -63,4 +63,4 @@ set(SOURCES
)
serenity_lib(LibGfx gfx)
target_link_libraries(LibGfx PRIVATE LibCompress LibCore LibCrypto LibTextCodec LibIPC LibUnicode)
target_link_libraries(LibGfx PRIVATE LibCompress LibCore LibCrypto LibFileSystem LibTextCodec LibIPC LibUnicode)

View file

@ -7,8 +7,8 @@
#include <AK/DeprecatedFlyString.h>
#include <AK/Queue.h>
#include <AK/QuickSort.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGfx/Font/Font.h>
#include <LibGfx/Font/FontDatabase.h>
#include <LibGfx/Font/OpenType/Font.h>
@ -135,7 +135,7 @@ void FontDatabase::load_all_fonts_from_path(DeprecatedString const& root)
while (dir_iterator.has_next()) {
auto path = dir_iterator.next_full_path();
if (Core::DeprecatedFile::is_directory(path)) {
if (FileSystem::is_directory(path)) {
path_queue.enqueue(path);
continue;
}

View file

@ -4,4 +4,4 @@ set(SOURCES
)
serenity_lib(LibIDL idl)
target_link_libraries(LibIDL PRIVATE LibCore)
target_link_libraries(LibIDL PRIVATE LibCore LibFileSystem)

View file

@ -13,6 +13,7 @@
#include <AK/QuickSort.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/File.h>
#include <LibFileSystem/FileSystem.h>
[[noreturn]] static void report_parsing_error(StringView message, StringView filename, StringView input, size_t offset)
{
@ -138,7 +139,7 @@ static HashTable<DeprecatedString> import_stack;
Optional<Interface&> Parser::resolve_import(auto path)
{
auto include_path = LexicalPath::join(import_base_path, path).string();
if (!Core::DeprecatedFile::exists(include_path))
if (!FileSystem::exists(include_path))
report_parsing_error(DeprecatedString::formatted("{}: No such file or directory", include_path), filename, input, lexer.tell());
auto real_path = Core::DeprecatedFile::real_path_for(include_path);

View file

@ -265,4 +265,4 @@ set(SOURCES
)
serenity_lib(LibJS js)
target_link_libraries(LibJS PRIVATE LibCore LibCrypto LibRegex LibSyntax LibLocale LibUnicode)
target_link_libraries(LibJS PRIVATE LibCore LibCrypto LibFileSystem LibRegex LibSyntax LibLocale LibUnicode)

View file

@ -13,6 +13,7 @@
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.h>
#include <LibJS/AST.h>
#include <LibJS/Interpreter.h>
#include <LibJS/Runtime/AbstractOperations.h>
@ -854,18 +855,18 @@ static DeprecatedString resolve_module_filename(StringView filename, StringView
auto extensions = Vector<StringView, 2> { "js"sv, "mjs"sv };
if (module_type == "json"sv)
extensions = { "json"sv };
if (!Core::DeprecatedFile::exists(filename)) {
if (!FileSystem::exists(filename)) {
for (auto extension : extensions) {
// import "./foo" -> import "./foo.ext"
auto resolved_filepath = DeprecatedString::formatted("{}.{}", filename, extension);
if (Core::DeprecatedFile::exists(resolved_filepath))
if (FileSystem::exists(resolved_filepath))
return resolved_filepath;
}
} else if (Core::DeprecatedFile::is_directory(filename)) {
} else if (FileSystem::is_directory(filename)) {
for (auto extension : extensions) {
// import "./foo" -> import "./foo/index.ext"
auto resolved_filepath = LexicalPath::join(filename, DeprecatedString::formatted("index.{}", extension)).string();
if (Core::DeprecatedFile::exists(resolved_filepath))
if (FileSystem::exists(resolved_filepath))
return resolved_filepath;
}
}

View file

@ -7,4 +7,4 @@ set(SOURCES
)
serenity_lib(LibManual manual)
target_link_libraries(LibManual PRIVATE LibCore)
target_link_libraries(LibManual PRIVATE LibCore LibFileSystem)

View file

@ -12,7 +12,7 @@
#include <AK/Optional.h>
#include <AK/StringView.h>
#include <AK/URL.h>
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.h>
#include <LibManual/Path.h>
namespace Manual {
@ -48,7 +48,7 @@ ErrorOr<NonnullRefPtr<PageNode const>> Node::try_create_from_query(Vector<String
Optional<NonnullRefPtr<PageNode>> maybe_page;
for (auto const& section : sections) {
auto const page = TRY(try_make_ref_counted<PageNode>(section, TRY(String::from_utf8(first_query_parameter))));
if (Core::DeprecatedFile::exists(TRY(page->path()))) {
if (FileSystem::exists(TRY(page->path()))) {
maybe_page = page;
break;
}
@ -61,7 +61,7 @@ ErrorOr<NonnullRefPtr<PageNode const>> Node::try_create_from_query(Vector<String
auto second_query_parameter = *query_parameter_iterator;
auto section = TRY(SectionNode::try_create_from_number(first_query_parameter));
auto const page = TRY(try_make_ref_counted<PageNode>(section, TRY(String::from_utf8(second_query_parameter))));
if (Core::DeprecatedFile::exists(TRY(page->path())))
if (FileSystem::exists(TRY(page->path())))
return page;
return Error::from_string_literal("Page doesn't exist in section");
}

View file

@ -10,8 +10,8 @@
#include "SubsectionNode.h"
#include <AK/LexicalPath.h>
#include <AK/QuickSort.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibFileSystem/FileSystem.h>
namespace Manual {
@ -54,7 +54,7 @@ ErrorOr<void> SectionNode::reify_if_needed() const
while (dir_iter.has_next()) {
LexicalPath lexical_path(dir_iter.next_path());
if (lexical_path.extension() != "md") {
if (Core::DeprecatedFile::is_directory(LexicalPath::absolute_path(own_path.to_deprecated_string(), lexical_path.string()))) {
if (FileSystem::is_directory(LexicalPath::absolute_path(own_path.to_deprecated_string(), lexical_path.string()))) {
dbgln("Found subsection {}", lexical_path);
children.append({ .node = TRY(try_make_ref_counted<SubsectionNode>(*this, lexical_path.title())),
.name_for_sorting = TRY(String::from_utf8(lexical_path.title())) });

View file

@ -41,4 +41,4 @@ set(GENERATED_SOURCES
)
serenity_lib(LibSQL sql)
target_link_libraries(LibSQL PRIVATE LibCore LibIPC LibSyntax LibRegex)
target_link_libraries(LibSQL PRIVATE LibCore LibFileSystem LibIPC LibSyntax LibRegex)

View file

@ -10,11 +10,11 @@
#include <LibSQL/SQLClient.h>
#if !defined(AK_OS_SERENITY)
# include <LibCore/DeprecatedFile.h>
# include <LibCore/Directory.h>
# include <LibCore/SocketAddress.h>
# include <LibCore/StandardPaths.h>
# include <LibCore/System.h>
# include <LibFileSystem/FileSystem.h>
#endif
namespace SQL {
@ -24,7 +24,7 @@ namespace SQL {
// This is heavily based on how SystemServer's Service creates its socket.
static ErrorOr<int> create_database_socket(DeprecatedString const& socket_path)
{
if (Core::DeprecatedFile::exists(socket_path))
if (FileSystem::exists(socket_path))
TRY(Core::System::unlink(socket_path));
# ifdef SOCK_NONBLOCK
@ -102,7 +102,7 @@ static ErrorOr<void> launch_server(DeprecatedString const& socket_path, Deprecat
static ErrorOr<bool> should_launch_server(DeprecatedString const& pid_path)
{
if (!Core::DeprecatedFile::exists(pid_path))
if (!FileSystem::exists(pid_path))
return true;
Optional<pid_t> pid;

View file

@ -3,4 +3,4 @@ set(SOURCES
)
serenity_lib(LibSymbolication symbolication)
target_link_libraries(LibSymbolication PRIVATE LibCore LibDebug)
target_link_libraries(LibSymbolication PRIVATE LibCore LibDebug LibFileSystem)

View file

@ -13,6 +13,7 @@
#include <LibCore/DeprecatedFile.h>
#include <LibCore/MappedFile.h>
#include <LibDebug/DebugInfo.h>
#include <LibFileSystem/FileSystem.h>
#include <LibSymbolication/Symbolication.h>
namespace Symbolication {
@ -65,7 +66,7 @@ Optional<Symbol> symbolicate(DeprecatedString const& path, FlatPtr address, Incl
bool found = false;
for (auto& search_path : search_paths) {
full_path = LexicalPath::join(search_path, path).string();
if (Core::DeprecatedFile::exists(full_path)) {
if (FileSystem::exists(full_path)) {
found = true;
break;
}

View file

@ -8,6 +8,7 @@
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.h>
#include <LibTest/JavaScriptTestRunner.h>
#include <signal.h>
#include <stdio.h>
@ -158,7 +159,7 @@ int main(int argc, char** argv)
common_path = DeprecatedString::formatted("{}/Userland/Libraries/LibJS/Tests/test-common.js", serenity_source_dir);
#endif
}
if (!Core::DeprecatedFile::is_directory(test_root)) {
if (!FileSystem::is_directory(test_root)) {
warnln("Test root is not a directory: {}", test_root);
return 1;
}

View file

@ -10,4 +10,4 @@ set(SOURCES
)
serenity_bin(SystemServer)
target_link_libraries(SystemServer PRIVATE LibCore LibMain)
target_link_libraries(SystemServer PRIVATE LibCore LibFileSystem LibMain)

View file

@ -12,11 +12,11 @@
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <LibCore/ConfigFile.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
#include <LibCore/SessionManagement.h>
#include <LibCore/SocketAddress.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
#include <fcntl.h>
#include <sched.h>
#include <stdio.h>
@ -123,7 +123,7 @@ ErrorOr<void> Service::activate()
ErrorOr<void> Service::spawn(int socket_fd)
{
if (!Core::DeprecatedFile::exists(m_executable_path)) {
if (!FileSystem::exists(m_executable_path)) {
dbgln("{}: binary \"{}\" does not exist, skipping service.", name(), m_executable_path);
return Error::from_errno(ENOENT);
}

View file

@ -28,5 +28,5 @@ set(GENERATED_SOURCES
)
serenity_bin(WebContent)
target_link_libraries(WebContent PRIVATE LibCore LibIPC LibGfx LibImageDecoderClient LibJS LibWebView LibWeb LibLocale LibMain)
target_link_libraries(WebContent PRIVATE LibCore LibFileSystem LibIPC LibGfx LibImageDecoderClient LibJS LibWebView LibWeb LibLocale LibMain)
link_with_locale_data(WebContent)

View file

@ -5,11 +5,11 @@
*/
#include "ImageCodecPluginSerenity.h"
#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
#include <LibCore/LocalServer.h>
#include <LibCore/StandardPaths.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
#include <LibIPC/SingleServer.h>
#include <LibMain/Main.h>
#include <LibWeb/Bindings/MainThreadVM.h>
@ -29,7 +29,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
// This must be first; we can't check if /tmp/webdriver exists once we've unveiled other paths.
auto webdriver_socket_path = DeprecatedString::formatted("{}/webdriver", TRY(Core::StandardPaths::runtime_directory()));
if (Core::DeprecatedFile::exists(webdriver_socket_path))
if (FileSystem::exists(webdriver_socket_path))
TRY(Core::System::unveil(webdriver_socket_path, "rw"sv));
TRY(Core::System::unveil("/res", "r"));

View file

@ -10,4 +10,4 @@ set(SOURCES
)
serenity_bin(WebServer)
target_link_libraries(WebServer PRIVATE LibCore LibHTTP LibMain)
target_link_libraries(WebServer PRIVATE LibCore LibFileSystem LibHTTP LibMain)

View file

@ -19,6 +19,7 @@
#include <LibCore/File.h>
#include <LibCore/MappedFile.h>
#include <LibCore/MimeData.h>
#include <LibFileSystem/FileSystem.h>
#include <LibHTTP/HttpRequest.h>
#include <LibHTTP/HttpResponse.h>
#include <WebServer/Client.h>
@ -133,7 +134,7 @@ ErrorOr<bool> Client::handle_request(ReadonlyBytes raw_request)
path_builder.append(requested_path);
auto real_path = TRY(path_builder.to_string());
if (Core::DeprecatedFile::is_directory(real_path.bytes_as_string_view())) {
if (FileSystem::is_directory(real_path.bytes_as_string_view())) {
if (!resource_decoded.ends_with('/')) {
StringBuilder red;
@ -148,7 +149,7 @@ ErrorOr<bool> Client::handle_request(ReadonlyBytes raw_request)
index_html_path_builder.append(real_path);
index_html_path_builder.append("/index.html"sv);
auto index_html_path = TRY(index_html_path_builder.to_string());
if (!Core::DeprecatedFile::exists(index_html_path)) {
if (!FileSystem::exists(index_html_path)) {
TRY(handle_directory_listing(requested_path, real_path, request));
return true;
}
@ -170,7 +171,7 @@ ErrorOr<bool> Client::handle_request(ReadonlyBytes raw_request)
auto const info = ContentInfo {
.type = TRY(String::from_utf8(Core::guess_mime_type_based_on_filename(real_path.bytes_as_string_view()))),
.length = TRY(Core::DeprecatedFile::size(real_path.bytes_as_string_view()))
.length = TRY(FileSystem::size(real_path.bytes_as_string_view()))
};
TRY(send_response(*stream, request, move(info)));
return true;

View file

@ -13,6 +13,7 @@
#include <LibCore/MappedFile.h>
#include <LibCore/System.h>
#include <LibCore/TCPServer.h>
#include <LibFileSystem/FileSystem.h>
#include <LibHTTP/HttpRequest.h>
#include <LibMain/Main.h>
#include <WebServer/Client.h>
@ -57,7 +58,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
auto real_document_root_path = Core::DeprecatedFile::real_path_for(document_root_path);
if (!Core::DeprecatedFile::exists(real_document_root_path)) {
if (!FileSystem::exists(real_document_root_path)) {
warnln("Root path does not exist: '{}'", document_root_path);
return 1;
}

View file

@ -45,5 +45,5 @@ set(GENERATED_SOURCES
)
serenity_bin(WindowServer)
target_link_libraries(WindowServer PRIVATE LibCore LibGfx LibThreading LibIPC LibMain)
target_link_libraries(WindowServer PRIVATE LibCore LibFileSystem LibGfx LibThreading LibIPC LibMain)
serenity_install_headers(Services/WindowServer)

View file

@ -11,9 +11,9 @@
#include "WindowManager.h"
#include <Kernel/API/Graphics.h>
#include <LibCore/ConfigFile.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGfx/Palette.h>
#include <LibGfx/SystemTheme.h>
#include <LibMain/Main.h>
@ -89,7 +89,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
if (!path.starts_with("connector"sv))
continue;
auto full_path = DeprecatedString::formatted("/dev/gpu/{}", path);
if (!Core::DeprecatedFile::is_device(full_path))
if (!FileSystem::is_device(full_path))
continue;
auto display_connector_fd = TRY(Core::System::open(full_path, O_RDWR | O_CLOEXEC));
if (int rc = graphics_connector_set_responsible(display_connector_fd); rc != 0)

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);
}
};

View file

@ -80,6 +80,8 @@ target_link_libraries(chres PRIVATE LibGUI LibIPC)
target_link_libraries(cksum PRIVATE LibCrypto)
target_link_libraries(config PRIVATE LibConfig LibIPC)
target_link_libraries(copy PRIVATE LibGUI)
target_link_libraries(comm PRIVATE LibFileSystem)
target_link_libraries(cp PRIVATE LibFileSystem)
target_link_libraries(cpp-lexer PRIVATE LibCpp)
target_link_libraries(cpp-parser PRIVATE LibCpp)
target_link_libraries(cpp-preprocessor PRIVATE LibCpp)
@ -90,26 +92,29 @@ target_link_libraries(fdtdump PRIVATE LibDeviceTree)
target_link_libraries(file PRIVATE LibGfx LibIPC LibCompress LibAudio)
target_link_libraries(functrace PRIVATE LibDebug LibX86)
target_link_libraries(gml-format PRIVATE LibGUI)
target_link_libraries(grep PRIVATE LibRegex)
target_link_libraries(grep PRIVATE LibFileSystem LibRegex)
target_link_libraries(gunzip PRIVATE LibCompress)
target_link_libraries(gzip PRIVATE LibCompress)
target_link_libraries(headless-browser PRIVATE LibCrypto LibGemini LibGfx LibHTTP LibTLS LibWeb LibWebView LibWebSocket LibIPC LibJS)
target_link_libraries(headless-browser PRIVATE LibCrypto LibFileSystem LibGemini LibGfx LibHTTP LibTLS LibWeb LibWebView LibWebSocket LibIPC LibJS)
target_link_libraries(icc PRIVATE LibGfx LibVideo)
target_link_libraries(image PRIVATE LibGfx)
target_link_libraries(image2bin PRIVATE LibGfx)
target_link_libraries(ini PRIVATE LibFileSystem)
target_link_libraries(jail-attach PRIVATE LibCore LibMain)
target_link_libraries(jail-create PRIVATE LibCore LibMain)
target_link_libraries(js PRIVATE LibCrypto LibJS LibLine LibLocale LibTextCodec)
link_with_locale_data(js)
target_link_libraries(keymap PRIVATE LibKeyboard)
target_link_libraries(less PRIVATE LibLine)
target_link_libraries(ls PRIVATE LibFileSystem)
target_link_libraries(lspci PRIVATE LibPCIDB)
target_link_libraries(lsusb PRIVATE LibUSBDB)
target_link_libraries(lzcat PRIVATE LibCompress)
target_link_libraries(man PRIVATE LibMarkdown LibManual)
target_link_libraries(markdown-check PRIVATE LibMarkdown)
target_link_libraries(markdown-check PRIVATE LibFileSystem LibMarkdown)
target_link_libraries(matroska PRIVATE LibVideo)
target_link_libraries(md PRIVATE LibMarkdown)
target_link_libraries(mv PRIVATE LibFileSystem)
target_link_libraries(notify PRIVATE LibGfx LibGUI)
target_link_libraries(open PRIVATE LibDesktop)
target_link_libraries(passwd PRIVATE LibCrypt)
@ -117,29 +122,33 @@ target_link_libraries(paste PRIVATE LibGUI)
target_link_libraries(pgrep PRIVATE LibRegex)
target_link_libraries(pkill PRIVATE LibRegex)
target_link_libraries(pls PRIVATE LibCrypt)
target_link_libraries(pro PRIVATE LibProtocol LibHTTP)
target_link_libraries(run-tests PRIVATE LibRegex LibCoredump LibDebug)
target_link_libraries(pro PRIVATE LibFileSystem LibProtocol LibHTTP)
target_link_libraries(run-tests PRIVATE LibCoredump LibDebug LibFileSystem LibRegex)
target_link_libraries(rm PRIVATE LibFileSystem)
target_link_libraries(sed PRIVATE LibRegex)
target_link_libraries(shot PRIVATE LibGfx LibGUI LibIPC)
target_link_libraries(sql PRIVATE LibLine LibSQL LibIPC)
target_link_libraries(sql PRIVATE LibFileSystem LibIPC LibLine LibSQL)
target_link_libraries(su PRIVATE LibCrypt)
target_link_libraries(syscall PRIVATE LibSystem)
target_link_libraries(ttfdisasm PRIVATE LibGfx)
target_link_libraries(tar PRIVATE LibArchive LibCompress)
target_link_libraries(tar PRIVATE LibArchive LibCompress LibFileSystem)
target_link_libraries(telws PRIVATE LibProtocol LibLine)
target_link_libraries(test-fuzz PRIVATE LibGemini LibGfx LibHTTP LibIPC LibJS LibMarkdown LibRegex LibShell)
target_link_libraries(test-imap PRIVATE LibIMAP)
target_link_libraries(test-pthread PRIVATE LibThreading)
target_link_libraries(touch PRIVATE LibFileSystem)
target_link_libraries(unveil PRIVATE LibMain)
target_link_libraries(unzip PRIVATE LibArchive LibCompress LibCrypto)
target_link_libraries(unzip PRIVATE LibArchive LibCompress LibCrypto LibFileSystem)
target_link_libraries(update-cpp-test-results PRIVATE LibCpp)
target_link_libraries(useradd PRIVATE LibCrypt)
target_link_libraries(userdel PRIVATE LibFileSystem)
target_link_libraries(wallpaper PRIVATE LibGfx LibGUI)
target_link_libraries(wasm PRIVATE LibWasm LibLine LibJS)
target_link_libraries(watch PRIVATE LibFileSystem)
target_link_libraries(wsctl PRIVATE LibGUI LibIPC)
target_link_libraries(xml PRIVATE LibXML)
target_link_libraries(xzcat PRIVATE LibCompress)
target_link_libraries(zip PRIVATE LibArchive LibCompress LibCrypto)
target_link_libraries(zip PRIVATE LibArchive LibCompress LibCrypto LibFileSystem)
# FIXME: Link this file into headless-browser without compiling it again.
target_sources(headless-browser PRIVATE "${SerenityOS_SOURCE_DIR}/Userland/Services/WebContent/WebDriverConnection.cpp")

View file

@ -6,9 +6,9 @@
*/
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
#include <LibMain/Main.h>
#include <string.h>
#include <strings.h>
@ -68,7 +68,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return false;
}
if (path != "-" && Core::DeprecatedFile::is_directory(path)) {
if (path != "-" && FileSystem::is_directory(path)) {
warnln("Failed to open file{} '{}': is a directory", file_number, path);
return false;
}

View file

@ -8,6 +8,7 @@
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
#include <LibMain/Main.h>
#include <stdio.h>
#include <unistd.h>
@ -69,7 +70,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio rpath wpath cpath fattr"));
}
bool destination_is_existing_dir = Core::DeprecatedFile::is_directory(destination);
bool destination_is_existing_dir = FileSystem::is_directory(destination);
for (auto& source : sources) {
auto destination_path = destination_is_existing_dir

View file

@ -11,10 +11,10 @@
#include <AK/StringBuilder.h>
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
#include <LibMain/Main.h>
#include <LibRegex/Regex.h>
#include <stdio.h>
@ -245,7 +245,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
Core::DirIterator it(recursive.value_or(base), Core::DirIterator::Flags::SkipDots);
while (it.has_next()) {
auto path = it.next_full_path();
if (!Core::DeprecatedFile::is_directory(path)) {
if (!FileSystem::is_directory(path)) {
auto key = user_has_specified_files ? path.view() : path.substring_view(base.length() + 1, path.length() - base.length() - 1);
if (auto result = handle_file(key, true); result.is_error() && !suppress_errors)
warnln("Failed with file {}: {}", key, result.release_error());

Some files were not shown because too many files have changed in this diff Show more