diff options
Diffstat (limited to 'Userland')
98 files changed, 233 insertions, 192 deletions
diff --git a/Userland/Applications/Browser/CMakeLists.txt b/Userland/Applications/Browser/CMakeLists.txt index 908c036417..e51c8ebe91 100644 --- a/Userland/Applications/Browser/CMakeLists.txt +++ b/Userland/Applications/Browser/CMakeLists.txt @@ -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) diff --git a/Userland/Applications/Browser/main.cpp b/Userland/Applications/Browser/main.cpp index 1d9738ab2b..d485e9bd1a 100644 --- a/Userland/Applications/Browser/main.cpp +++ b/Userland/Applications/Browser/main.cpp @@ -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); diff --git a/Userland/Applications/CrashReporter/CMakeLists.txt b/Userland/Applications/CrashReporter/CMakeLists.txt index 12bab1e8f5..e6da9f0168 100644 --- a/Userland/Applications/CrashReporter/CMakeLists.txt +++ b/Userland/Applications/CrashReporter/CMakeLists.txt @@ -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) diff --git a/Userland/Applications/CrashReporter/main.cpp b/Userland/Applications/CrashReporter/main.cpp index 03d7c8adea..978a060644 100644 --- a/Userland/Applications/CrashReporter/main.cpp +++ b/Userland/Applications/CrashReporter/main.cpp @@ -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"); } diff --git a/Userland/Applications/FileManager/CMakeLists.txt b/Userland/Applications/FileManager/CMakeLists.txt index be9447af5b..548c0ed585 100644 --- a/Userland/Applications/FileManager/CMakeLists.txt +++ b/Userland/Applications/FileManager/CMakeLists.txt @@ -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) diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp index 8c1713ba55..4d9b182cfb 100644 --- a/Userland/Applications/FileManager/DirectoryView.cpp +++ b/Userland/Applications/FileManager/DirectoryView.cpp @@ -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 } diff --git a/Userland/Applications/FileManager/FileUtils.cpp b/Userland/Applications/FileManager/FileUtils.cpp index 0388701ed3..4e8d4c79aa 100644 --- a/Userland/Applications/FileManager/FileUtils.cpp +++ b/Userland/Applications/FileManager/FileUtils.cpp @@ -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; diff --git a/Userland/Applications/FileManager/PropertiesWindow.cpp b/Userland/Applications/FileManager/PropertiesWindow.cpp index 8c66189960..2ce754edfb 100644 --- a/Userland/Applications/FileManager/PropertiesWindow.cpp +++ b/Userland/Applications/FileManager/PropertiesWindow.cpp @@ -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; } diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp index 6e67a5d90a..fcd46dbd67 100644 --- a/Userland/Applications/FileManager/main.cpp +++ b/Userland/Applications/FileManager/main.cpp @@ -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); diff --git a/Userland/Applications/PartitionEditor/CMakeLists.txt b/Userland/Applications/PartitionEditor/CMakeLists.txt index cbf99f0f56..79294f42f0 100644 --- a/Userland/Applications/PartitionEditor/CMakeLists.txt +++ b/Userland/Applications/PartitionEditor/CMakeLists.txt @@ -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) diff --git a/Userland/Applications/PartitionEditor/PartitionModel.cpp b/Userland/Applications/PartitionEditor/PartitionModel.cpp index 73f7da320e..90859254e4 100644 --- a/Userland/Applications/PartitionEditor/PartitionModel.cpp +++ b/Userland/Applications/PartitionEditor/PartitionModel.cpp @@ -13,6 +13,11 @@ namespace PartitionEditor { +NonnullRefPtr<PartitionModel> PartitionModel::create() +{ + return adopt_ref(*new PartitionModel); +} + DeprecatedString PartitionModel::column_name(int column) const { switch (column) { diff --git a/Userland/Applications/PartitionEditor/PartitionModel.h b/Userland/Applications/PartitionEditor/PartitionModel.h index a54165062f..e7ce742a2b 100644 --- a/Userland/Applications/PartitionEditor/PartitionModel.h +++ b/Userland/Applications/PartitionEditor/PartitionModel.h @@ -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(); } diff --git a/Userland/Applications/PartitionEditor/main.cpp b/Userland/Applications/PartitionEditor/main.cpp index ad1cb4c15b..202726fe59 100644 --- a/Userland/Applications/PartitionEditor/main.cpp +++ b/Userland/Applications/PartitionEditor/main.cpp @@ -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; }); diff --git a/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp b/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp index 3eeda05ed7..5c56a5bdaa 100644 --- a/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp +++ b/Userland/Applications/SoundPlayer/AlbumCoverVisualizationWidget.cpp @@ -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()); } diff --git a/Userland/Applications/SoundPlayer/CMakeLists.txt b/Userland/Applications/SoundPlayer/CMakeLists.txt index c827fc42b3..66926eb5e4 100644 --- a/Userland/Applications/SoundPlayer/CMakeLists.txt +++ b/Userland/Applications/SoundPlayer/CMakeLists.txt @@ -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) diff --git a/Userland/Applications/SoundPlayer/Player.cpp b/Userland/Applications/SoundPlayer/Player.cpp index af254a0480..41c874cdd0 100644 --- a/Userland/Applications/SoundPlayer/Player.cpp +++ b/Userland/Applications/SoundPlayer/Player.cpp @@ -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; } diff --git a/Userland/Applications/SoundPlayer/Playlist.cpp b/Userland/Applications/SoundPlayer/Playlist.cpp index 63bd4e9774..6e841291ed 100644 --- a/Userland/Applications/SoundPlayer/Playlist.cpp +++ b/Userland/Applications/SoundPlayer/Playlist.cpp @@ -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; } diff --git a/Userland/Applications/SpaceAnalyzer/CMakeLists.txt b/Userland/Applications/SpaceAnalyzer/CMakeLists.txt index 6783b80b20..a6f1e4c3c4 100644 --- a/Userland/Applications/SpaceAnalyzer/CMakeLists.txt +++ b/Userland/Applications/SpaceAnalyzer/CMakeLists.txt @@ -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) diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp index 4a83bbef40..7fb7eef626 100644 --- a/Userland/Applications/SpaceAnalyzer/main.cpp +++ b/Userland/Applications/SpaceAnalyzer/main.cpp @@ -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"); diff --git a/Userland/Applications/Spreadsheet/CMakeLists.txt b/Userland/Applications/Spreadsheet/CMakeLists.txt index 1e6753198c..e4affa4cb4 100644 --- a/Userland/Applications/Spreadsheet/CMakeLists.txt +++ b/Userland/Applications/Spreadsheet/CMakeLists.txt @@ -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) diff --git a/Userland/Applications/Spreadsheet/main.cpp b/Userland/Applications/Spreadsheet/main.cpp index d7599cc235..bd1cc8a8a0 100644 --- a/Userland/Applications/Spreadsheet/main.cpp +++ b/Userland/Applications/Spreadsheet/main.cpp @@ -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; } diff --git a/Userland/Applications/ThemeEditor/CMakeLists.txt b/Userland/Applications/ThemeEditor/CMakeLists.txt index fcb9b9fbc3..95ee3c629c 100644 --- a/Userland/Applications/ThemeEditor/CMakeLists.txt +++ b/Userland/Applications/ThemeEditor/CMakeLists.txt @@ -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) diff --git a/Userland/Applications/ThemeEditor/MainWidget.cpp b/Userland/Applications/ThemeEditor/MainWidget.cpp index 74c217a6fc..f2a812c9c8 100644 --- a/Userland/Applications/ThemeEditor/MainWidget.cpp +++ b/Userland/Applications/ThemeEditor/MainWidget.cpp @@ -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"; diff --git a/Userland/BuggieBox/CMakeLists.txt b/Userland/BuggieBox/CMakeLists.txt index fcd294ed8b..2f2464e05b 100644 --- a/Userland/BuggieBox/CMakeLists.txt +++ b/Userland/BuggieBox/CMakeLists.txt @@ -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}) diff --git a/Userland/DevTools/HackStudio/CMakeLists.txt b/Userland/DevTools/HackStudio/CMakeLists.txt index ecd3c084a2..92373ace9e 100644 --- a/Userland/DevTools/HackStudio/CMakeLists.txt +++ b/Userland/DevTools/HackStudio/CMakeLists.txt @@ -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) diff --git a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp index 597b50860c..21fae01e08 100644 --- a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp @@ -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; diff --git a/Userland/DevTools/HackStudio/Editor.cpp b/Userland/DevTools/HackStudio/Editor.cpp index 0fe712fd44..ad0f9f81ac 100644 --- a/Userland/DevTools/HackStudio/Editor.cpp +++ b/Userland/DevTools/HackStudio/Editor.cpp @@ -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); diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index e631627a8d..ae2b2a2a5d 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -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); } diff --git a/Userland/DevTools/HackStudio/Project.cpp b/Userland/DevTools/HackStudio/Project.cpp index f15a33fc6c..1358958cc2 100644 --- a/Userland/DevTools/HackStudio/Project.cpp +++ b/Userland/DevTools/HackStudio/Project.cpp @@ -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)); } diff --git a/Userland/DevTools/HackStudio/ProjectBuilder.cpp b/Userland/DevTools/HackStudio/ProjectBuilder.cpp index b18ee7a99e..91f3141721 100644 --- a/Userland/DevTools/HackStudio/ProjectBuilder.cpp +++ b/Userland/DevTools/HackStudio/ProjectBuilder.cpp @@ -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); } diff --git a/Userland/DevTools/HackStudio/ProjectTemplate.cpp b/Userland/DevTools/HackStudio/ProjectTemplate.cpp index 3f4983ab2e..9f9b0892bd 100644 --- a/Userland/DevTools/HackStudio/ProjectTemplate.cpp +++ b/Userland/DevTools/HackStudio/ProjectTemplate.cpp @@ -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()) diff --git a/Userland/DevTools/HackStudio/main.cpp b/Userland/DevTools/HackStudio/main.cpp index aaed97dade..abf1777a21 100644 --- a/Userland/DevTools/HackStudio/main.cpp +++ b/Userland/DevTools/HackStudio/main.cpp @@ -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] }; diff --git a/Userland/DevTools/Profiler/CMakeLists.txt b/Userland/DevTools/Profiler/CMakeLists.txt index 94bd3ea0e5..bf3aa6b4cf 100644 --- a/Userland/DevTools/Profiler/CMakeLists.txt +++ b/Userland/DevTools/Profiler/CMakeLists.txt @@ -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) diff --git a/Userland/DevTools/Profiler/Process.cpp b/Userland/DevTools/Profiler/Process.cpp index 2fdcb376ea..b21b2f45de 100644 --- a/Userland/DevTools/Profiler/Process.cpp +++ b/Userland/DevTools/Profiler/Process.cpp @@ -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; diff --git a/Userland/DevTools/SQLStudio/CMakeLists.txt b/Userland/DevTools/SQLStudio/CMakeLists.txt index 143734e7df..3b181de45f 100644 --- a/Userland/DevTools/SQLStudio/CMakeLists.txt +++ b/Userland/DevTools/SQLStudio/CMakeLists.txt @@ -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) diff --git a/Userland/DevTools/SQLStudio/MainWidget.cpp b/Userland/DevTools/SQLStudio/MainWidget.cpp index c87992e3a6..78a2c3250f 100644 --- a/Userland/DevTools/SQLStudio/MainWidget.cpp +++ b/Userland/DevTools/SQLStudio/MainWidget.cpp @@ -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); diff --git a/Userland/DevTools/UserspaceEmulator/CMakeLists.txt b/Userland/DevTools/UserspaceEmulator/CMakeLists.txt index 73b4daa3bd..7135ba09af 100644 --- a/Userland/DevTools/UserspaceEmulator/CMakeLists.txt +++ b/Userland/DevTools/UserspaceEmulator/CMakeLists.txt @@ -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) diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.cpp b/Userland/DevTools/UserspaceEmulator/Emulator.cpp index a0207c4acf..b73082053e 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator.cpp @@ -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); } diff --git a/Userland/Games/Snake/CMakeLists.txt b/Userland/Games/Snake/CMakeLists.txt index 687f0d419f..b92db998fd 100644 --- a/Userland/Games/Snake/CMakeLists.txt +++ b/Userland/Games/Snake/CMakeLists.txt @@ -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) diff --git a/Userland/Games/Snake/Skins/SnakeSkin.cpp b/Userland/Games/Snake/Skins/SnakeSkin.cpp index da1d77729f..e797725b85 100644 --- a/Userland/Games/Snake/Skins/SnakeSkin.cpp +++ b/Userland/Games/Snake/Skins/SnakeSkin.cpp @@ -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 diff --git a/Userland/Libraries/LibCodeComprehension/Cpp/CMakeLists.txt b/Userland/Libraries/LibCodeComprehension/Cpp/CMakeLists.txt index 63c75e98c1..d8e1896132 100644 --- a/Userland/Libraries/LibCodeComprehension/Cpp/CMakeLists.txt +++ b/Userland/Libraries/LibCodeComprehension/Cpp/CMakeLists.txt @@ -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) diff --git a/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp b/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp index 7d7c44d964..ceb5203894 100644 --- a/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp +++ b/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp @@ -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); diff --git a/Userland/Libraries/LibCoredump/Backtrace.cpp b/Userland/Libraries/LibCoredump/Backtrace.cpp index 94ae94859b..a4bcf9d51c 100644 --- a/Userland/Libraries/LibCoredump/Backtrace.cpp +++ b/Userland/Libraries/LibCoredump/Backtrace.cpp @@ -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); diff --git a/Userland/Libraries/LibCoredump/CMakeLists.txt b/Userland/Libraries/LibCoredump/CMakeLists.txt index a627b00e97..62aba7bac8 100644 --- a/Userland/Libraries/LibCoredump/CMakeLists.txt +++ b/Userland/Libraries/LibCoredump/CMakeLists.txt @@ -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) diff --git a/Userland/Libraries/LibCoredump/Reader.cpp b/Userland/Libraries/LibCoredump/Reader.cpp index dbbdc2285d..e071f472ad 100644 --- a/Userland/Libraries/LibCoredump/Reader.cpp +++ b/Userland/Libraries/LibCoredump/Reader.cpp @@ -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; } diff --git a/Userland/Libraries/LibDebug/CMakeLists.txt b/Userland/Libraries/LibDebug/CMakeLists.txt index 878c970418..fbfc578171 100644 --- a/Userland/Libraries/LibDebug/CMakeLists.txt +++ b/Userland/Libraries/LibDebug/CMakeLists.txt @@ -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) diff --git a/Userland/Libraries/LibDebug/DebugSession.cpp b/Userland/Libraries/LibDebug/DebugSession.cpp index 451d4a17a2..cddfe4aed5 100644 --- a/Userland/Libraries/LibDebug/DebugSession.cpp +++ b/Userland/Libraries/LibDebug/DebugSession.cpp @@ -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); diff --git a/Userland/Libraries/LibFileSystemAccessClient/CMakeLists.txt b/Userland/Libraries/LibFileSystemAccessClient/CMakeLists.txt index 87c8ccea06..7d0b4537b5 100644 --- a/Userland/Libraries/LibFileSystemAccessClient/CMakeLists.txt +++ b/Userland/Libraries/LibFileSystemAccessClient/CMakeLists.txt @@ -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) diff --git a/Userland/Libraries/LibFileSystemAccessClient/Client.cpp b/Userland/Libraries/LibFileSystemAccessClient/Client.cpp index e4c7f18567..ea4af7a457 100644 --- a/Userland/Libraries/LibFileSystemAccessClient/Client.cpp +++ b/Userland/Libraries/LibFileSystemAccessClient/Client.cpp @@ -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; diff --git a/Userland/Libraries/LibGUI/CMakeLists.txt b/Userland/Libraries/LibGUI/CMakeLists.txt index 7cc61bd0a4..c6e740f20d 100644 --- a/Userland/Libraries/LibGUI/CMakeLists.txt +++ b/Userland/Libraries/LibGUI/CMakeLists.txt @@ -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) diff --git a/Userland/Libraries/LibGUI/CommonLocationsProvider.cpp b/Userland/Libraries/LibGUI/CommonLocationsProvider.cpp index ba81d3aa19..5928651cbd 100644 --- a/Userland/Libraries/LibGUI/CommonLocationsProvider.cpp +++ b/Userland/Libraries/LibGUI/CommonLocationsProvider.cpp @@ -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; diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index c984dfc6dd..dced842f09 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/Userland/Libraries/LibGUI/FilePicker.cpp @@ -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); diff --git a/Userland/Libraries/LibGUI/PathBreadcrumbbar.cpp b/Userland/Libraries/LibGUI/PathBreadcrumbbar.cpp index 78988a3df3..062cb423ff 100644 --- a/Userland/Libraries/LibGUI/PathBreadcrumbbar.cpp +++ b/Userland/Libraries/LibGUI/PathBreadcrumbbar.cpp @@ -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 { diff --git a/Userland/Libraries/LibGfx/CMakeLists.txt b/Userland/Libraries/LibGfx/CMakeLists.txt index 259dd78fc9..38923c5e72 100644 --- a/Userland/Libraries/LibGfx/CMakeLists.txt +++ b/Userland/Libraries/LibGfx/CMakeLists.txt @@ -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) diff --git a/Userland/Libraries/LibGfx/Font/FontDatabase.cpp b/Userland/Libraries/LibGfx/Font/FontDatabase.cpp index 36ca33e75e..59bd281f6c 100644 --- a/Userland/Libraries/LibGfx/Font/FontDatabase.cpp +++ b/Userland/Libraries/LibGfx/Font/FontDatabase.cpp @@ -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; } diff --git a/Userland/Libraries/LibIDL/CMakeLists.txt b/Userland/Libraries/LibIDL/CMakeLists.txt index cc8ad431fd..93c73e8644 100644 --- a/Userland/Libraries/LibIDL/CMakeLists.txt +++ b/Userland/Libraries/LibIDL/CMakeLists.txt @@ -4,4 +4,4 @@ set(SOURCES ) serenity_lib(LibIDL idl) -target_link_libraries(LibIDL PRIVATE LibCore) +target_link_libraries(LibIDL PRIVATE LibCore LibFileSystem) diff --git a/Userland/Libraries/LibIDL/IDLParser.cpp b/Userland/Libraries/LibIDL/IDLParser.cpp index 0470c87fdb..240da5ff3c 100644 --- a/Userland/Libraries/LibIDL/IDLParser.cpp +++ b/Userland/Libraries/LibIDL/IDLParser.cpp @@ -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); diff --git a/Userland/Libraries/LibJS/CMakeLists.txt b/Userland/Libraries/LibJS/CMakeLists.txt index c08007f93c..d4ae494f21 100644 --- a/Userland/Libraries/LibJS/CMakeLists.txt +++ b/Userland/Libraries/LibJS/CMakeLists.txt @@ -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) diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index b6e9857ee2..3ce4588b65 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -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; } } diff --git a/Userland/Libraries/LibManual/CMakeLists.txt b/Userland/Libraries/LibManual/CMakeLists.txt index 15b4c3d62b..20359709a5 100644 --- a/Userland/Libraries/LibManual/CMakeLists.txt +++ b/Userland/Libraries/LibManual/CMakeLists.txt @@ -7,4 +7,4 @@ set(SOURCES ) serenity_lib(LibManual manual) -target_link_libraries(LibManual PRIVATE LibCore) +target_link_libraries(LibManual PRIVATE LibCore LibFileSystem) diff --git a/Userland/Libraries/LibManual/Node.cpp b/Userland/Libraries/LibManual/Node.cpp index bfc11d55b4..3b48ae90c0 100644 --- a/Userland/Libraries/LibManual/Node.cpp +++ b/Userland/Libraries/LibManual/Node.cpp @@ -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"); } diff --git a/Userland/Libraries/LibManual/SectionNode.cpp b/Userland/Libraries/LibManual/SectionNode.cpp index 75db61043b..150f960f32 100644 --- a/Userland/Libraries/LibManual/SectionNode.cpp +++ b/Userland/Libraries/LibManual/SectionNode.cpp @@ -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())) }); diff --git a/Userland/Libraries/LibSQL/CMakeLists.txt b/Userland/Libraries/LibSQL/CMakeLists.txt index febcb1c28d..b782d824b4 100644 --- a/Userland/Libraries/LibSQL/CMakeLists.txt +++ b/Userland/Libraries/LibSQL/CMakeLists.txt @@ -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) diff --git a/Userland/Libraries/LibSQL/SQLClient.cpp b/Userland/Libraries/LibSQL/SQLClient.cpp index db9455b83e..9fdd842f0f 100644 --- a/Userland/Libraries/LibSQL/SQLClient.cpp +++ b/Userland/Libraries/LibSQL/SQLClient.cpp @@ -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; diff --git a/Userland/Libraries/LibSymbolication/CMakeLists.txt b/Userland/Libraries/LibSymbolication/CMakeLists.txt index 7d43eed41d..a5cdb4e4db 100644 --- a/Userland/Libraries/LibSymbolication/CMakeLists.txt +++ b/Userland/Libraries/LibSymbolication/CMakeLists.txt @@ -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) diff --git a/Userland/Libraries/LibSymbolication/Symbolication.cpp b/Userland/Libraries/LibSymbolication/Symbolication.cpp index 485a99782e..274c75aca6 100644 --- a/Userland/Libraries/LibSymbolication/Symbolication.cpp +++ b/Userland/Libraries/LibSymbolication/Symbolication.cpp @@ -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; } diff --git a/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp b/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp index e0f7edf3f6..9fc4fa8ad8 100644 --- a/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp +++ b/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp @@ -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; } diff --git a/Userland/Services/SystemServer/CMakeLists.txt b/Userland/Services/SystemServer/CMakeLists.txt index ac24b0bd43..583046f570 100644 --- a/Userland/Services/SystemServer/CMakeLists.txt +++ b/Userland/Services/SystemServer/CMakeLists.txt @@ -10,4 +10,4 @@ set(SOURCES ) serenity_bin(SystemServer) -target_link_libraries(SystemServer PRIVATE LibCore LibMain) +target_link_libraries(SystemServer PRIVATE LibCore LibFileSystem LibMain) diff --git a/Userland/Services/SystemServer/Service.cpp b/Userland/Services/SystemServer/Service.cpp index 56590f0d9e..c2fb68a0a4 100644 --- a/Userland/Services/SystemServer/Service.cpp +++ b/Userland/Services/SystemServer/Service.cpp @@ -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); } diff --git a/Userland/Services/WebContent/CMakeLists.txt b/Userland/Services/WebContent/CMakeLists.txt index c5c0e30247..ef0cf40da7 100644 --- a/Userland/Services/WebContent/CMakeLists.txt +++ b/Userland/Services/WebContent/CMakeLists.txt @@ -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) diff --git a/Userland/Services/WebContent/main.cpp b/Userland/Services/WebContent/main.cpp index caa0a2e48d..081f24bbb4 100644 --- a/Userland/Services/WebContent/main.cpp +++ b/Userland/Services/WebContent/main.cpp @@ -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")); diff --git a/Userland/Services/WebServer/CMakeLists.txt b/Userland/Services/WebServer/CMakeLists.txt index d682847f44..d788dec1e4 100644 --- a/Userland/Services/WebServer/CMakeLists.txt +++ b/Userland/Services/WebServer/CMakeLists.txt @@ -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) diff --git a/Userland/Services/WebServer/Client.cpp b/Userland/Services/WebServer/Client.cpp index 43b40da3e0..c91d8a0b40 100644 --- a/Userland/Services/WebServer/Client.cpp +++ b/Userland/Services/WebServer/Client.cpp @@ -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; diff --git a/Userland/Services/WebServer/main.cpp b/Userland/Services/WebServer/main.cpp index ecbf66928f..7f4dbadb62 100644 --- a/Userland/Services/WebServer/main.cpp +++ b/Userland/Services/WebServer/main.cpp @@ -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; } diff --git a/Userland/Services/WindowServer/CMakeLists.txt b/Userland/Services/WindowServer/CMakeLists.txt index b9a297592a..ed975c387e 100644 --- a/Userland/Services/WindowServer/CMakeLists.txt +++ b/Userland/Services/WindowServer/CMakeLists.txt @@ -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) diff --git a/Userland/Services/WindowServer/main.cpp b/Userland/Services/WindowServer/main.cpp index da17e92616..6b0176e1fb 100644 --- a/Userland/Services/WindowServer/main.cpp +++ b/Userland/Services/WindowServer/main.cpp @@ -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) diff --git a/Userland/Shell/AST.cpp b/Userland/Shell/AST.cpp index 09ddfd6956..4ba3f98700 100644 --- a/Userland/Shell/AST.cpp +++ b/Userland/Shell/AST.cpp @@ -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); diff --git a/Userland/Shell/CMakeLists.txt b/Userland/Shell/CMakeLists.txt index 961e205210..54099af286 100644 --- a/Userland/Shell/CMakeLists.txt +++ b/Userland/Shell/CMakeLists.txt @@ -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/*" diff --git a/Userland/Shell/main.cpp b/Userland/Shell/main.cpp index 90d5e40622..9ef4136352 100644 --- a/Userland/Shell/main.cpp +++ b/Userland/Shell/main.cpp @@ -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); } }; diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt index 001dcfc31c..906863dfa0 100644 --- a/Userland/Utilities/CMakeLists.txt +++ b/Userland/Utilities/CMakeLists.txt @@ -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") diff --git a/Userland/Utilities/comm.cpp b/Userland/Utilities/comm.cpp index 5a49cfded9..31c23f23a8 100644 --- a/Userland/Utilities/comm.cpp +++ b/Userland/Utilities/comm.cpp @@ -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; } diff --git a/Userland/Utilities/cp.cpp b/Userland/Utilities/cp.cpp index 38d160cd70..e83a0b0748 100644 --- a/Userland/Utilities/cp.cpp +++ b/Userland/Utilities/cp.cpp @@ -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 diff --git a/Userland/Utilities/grep.cpp b/Userland/Utilities/grep.cpp index 57309294dd..4a50c7707c 100644 --- a/Userland/Utilities/grep.cpp +++ b/Userland/Utilities/grep.cpp @@ -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()); diff --git a/Userland/Utilities/headless-browser.cpp b/Userland/Utilities/headless-browser.cpp index 2f081e2415..975c257726 100644 --- a/Userland/Utilities/headless-browser.cpp +++ b/Userland/Utilities/headless-browser.cpp @@ -24,6 +24,7 @@ #include <LibCore/EventLoop.h> #include <LibCore/File.h> #include <LibCore/Timer.h> +#include <LibFileSystem/FileSystem.h> #include <LibGfx/Bitmap.h> #include <LibGfx/Font/FontDatabase.h> #include <LibGfx/PNGWriter.h> @@ -164,8 +165,8 @@ static ErrorOr<NonnullRefPtr<Core::Timer>> load_page_for_screenshot_and_exit(Cor // FIXME: Allow passing the output path as an argument. static constexpr auto output_file_path = "output.png"sv; - if (Core::DeprecatedFile::exists(output_file_path)) - TRY(Core::DeprecatedFile::remove(output_file_path, Core::DeprecatedFile::RecursionMode::Disallowed)); + if (FileSystem::exists(output_file_path)) + TRY(FileSystem::remove(output_file_path, FileSystem::RecursionMode::Disallowed)); outln("Taking screenshot after {} seconds", screenshot_timeout); @@ -191,7 +192,7 @@ static ErrorOr<NonnullRefPtr<Core::Timer>> load_page_for_screenshot_and_exit(Cor static ErrorOr<URL> format_url(StringView url) { - if (Core::DeprecatedFile::exists(url)) + if (FileSystem::exists(url)) return URL::create_with_file_scheme(Core::DeprecatedFile::real_path_for(url)); URL formatted_url { url }; diff --git a/Userland/Utilities/ini.cpp b/Userland/Utilities/ini.cpp index 19e92bb76b..0053a98d60 100644 --- a/Userland/Utilities/ini.cpp +++ b/Userland/Utilities/ini.cpp @@ -6,8 +6,8 @@ #include <LibCore/ArgsParser.h> #include <LibCore/ConfigFile.h> -#include <LibCore/DeprecatedFile.h> #include <LibCore/System.h> +#include <LibFileSystem/FileSystem.h> #include <LibMain/Main.h> ErrorOr<int> serenity_main(Main::Arguments arguments) @@ -26,7 +26,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.add_positional_argument(value_to_write, "Value to write", "value", Core::ArgsParser::Required::No); args_parser.parse(arguments); - if (!Core::DeprecatedFile::exists(path)) { + if (!FileSystem::exists(path)) { warnln("File does not exist: '{}'", path); return 1; } diff --git a/Userland/Utilities/ls.cpp b/Userland/Utilities/ls.cpp index df4759f3f8..cc656e8447 100644 --- a/Userland/Utilities/ls.cpp +++ b/Userland/Utilities/ls.cpp @@ -18,6 +18,7 @@ #include <LibCore/DeprecatedFile.h> #include <LibCore/DirIterator.h> #include <LibCore/System.h> +#include <LibFileSystem/FileSystem.h> #include <LibMain/Main.h> #include <ctype.h> #include <dirent.h> @@ -164,7 +165,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) for (size_t i = 0; i < files.size(); i++) { auto path = files[i].name; - if (flag_recursive && Core::DeprecatedFile::is_directory(path)) { + if (flag_recursive && FileSystem::is_directory(path)) { size_t subdirs = 0; Core::DirIterator di(path, Core::DirIterator::SkipParentAndBaseDir); @@ -175,7 +176,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) while (di.has_next()) { DeprecatedString directory = di.next_full_path(); - if (Core::DeprecatedFile::is_directory(directory) && !Core::DeprecatedFile::is_link(directory)) { + if (FileSystem::is_directory(directory) && !FileSystem::is_link(directory)) { ++subdirs; FileMetadata new_file; new_file.name = move(directory); @@ -184,7 +185,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) } } - bool show_dir_separator = files.size() > 1 && Core::DeprecatedFile::is_directory(path) && !flag_list_directories_only; + bool show_dir_separator = files.size() > 1 && FileSystem::is_directory(path) && !flag_list_directories_only; if (show_dir_separator) { printf("%s:\n", path.characters()); } diff --git a/Userland/Utilities/markdown-check.cpp b/Userland/Utilities/markdown-check.cpp index ab6ce84eb8..47db678beb 100644 --- a/Userland/Utilities/markdown-check.cpp +++ b/Userland/Utilities/markdown-check.cpp @@ -21,6 +21,7 @@ #include <LibCore/ArgsParser.h> #include <LibCore/DeprecatedFile.h> #include <LibCore/File.h> +#include <LibFileSystem/FileSystem.h> #include <LibMain/Main.h> #include <LibMarkdown/Document.h> #include <LibMarkdown/Visitor.h> @@ -293,7 +294,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) } else { pointee_file = LexicalPath::absolute_path(file_dir, file_link.file_path); } - if (!Core::DeprecatedFile::exists(pointee_file) && !is_missing_file_acceptable(pointee_file)) { + if (!FileSystem::exists(pointee_file) && !is_missing_file_acceptable(pointee_file)) { outln("File '{}' points to '{}' (label '{}'), but '{}' does not exist!", file_item.key, file_link.file_path, file_link.label, pointee_file); any_problems = true; diff --git a/Userland/Utilities/mv.cpp b/Userland/Utilities/mv.cpp index 9b1af01a8e..306ae82c4a 100644 --- a/Userland/Utilities/mv.cpp +++ b/Userland/Utilities/mv.cpp @@ -9,6 +9,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 <string.h> @@ -69,7 +70,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) new_path = combined_new_path.characters(); } - if (no_clobber && Core::DeprecatedFile::exists(new_path)) + if (no_clobber && FileSystem::exists(new_path)) continue; rc = rename(old_path.characters(), new_path.characters()); diff --git a/Userland/Utilities/pro.cpp b/Userland/Utilities/pro.cpp index 5202296dad..41d20e9789 100644 --- a/Userland/Utilities/pro.cpp +++ b/Userland/Utilities/pro.cpp @@ -13,9 +13,9 @@ #include <AK/String.h> #include <AK/URL.h> #include <LibCore/ArgsParser.h> -#include <LibCore/DeprecatedFile.h> #include <LibCore/EventLoop.h> #include <LibCore/System.h> +#include <LibFileSystem/FileSystem.h> #include <LibHTTP/HttpResponse.h> #include <LibMain/Main.h> #include <LibProtocol/Request.h> @@ -337,7 +337,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) if (i > -1) output_name = DeprecatedString::formatted("{}.{}", output_name, i); ++i; - } while (Core::DeprecatedFile::exists(output_name)); + } while (FileSystem::exists(output_name)); } int target_file_fd = open(output_name.characters(), O_WRONLY | O_CREAT | O_TRUNC, 0644); diff --git a/Userland/Utilities/rm.cpp b/Userland/Utilities/rm.cpp index 4a34af01fa..107b9374c5 100644 --- a/Userland/Utilities/rm.cpp +++ b/Userland/Utilities/rm.cpp @@ -7,8 +7,8 @@ #include <AK/StringBuilder.h> #include <AK/Vector.h> #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> @@ -43,7 +43,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) continue; } - auto result = Core::DeprecatedFile::remove(path, recursive ? Core::DeprecatedFile::RecursionMode::Allowed : Core::DeprecatedFile::RecursionMode::Disallowed); + auto result = FileSystem::remove(path, recursive ? FileSystem::RecursionMode::Allowed : FileSystem::RecursionMode::Disallowed); if (result.is_error()) { auto error = result.release_error(); diff --git a/Userland/Utilities/run-tests.cpp b/Userland/Utilities/run-tests.cpp index 2d75897efe..0eba0b7190 100644 --- a/Userland/Utilities/run-tests.cpp +++ b/Userland/Utilities/run-tests.cpp @@ -10,6 +10,7 @@ #include <LibCore/DeprecatedFile.h> #include <LibCore/System.h> #include <LibCoredump/Backtrace.h> +#include <LibFileSystem/FileSystem.h> #include <LibMain/Main.h> #include <LibRegex/Regex.h> #include <LibTest/TestRunner.h> @@ -365,7 +366,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) } else { test_root = "/usr/Tests"; } - if (!Core::DeprecatedFile::is_directory(test_root)) { + if (!FileSystem::is_directory(test_root)) { warnln("Test root is not a directory: {}", test_root); return 1; } diff --git a/Userland/Utilities/sql.cpp b/Userland/Utilities/sql.cpp index 9d68d4646d..2b6516b971 100644 --- a/Userland/Utilities/sql.cpp +++ b/Userland/Utilities/sql.cpp @@ -10,8 +10,8 @@ #include <AK/String.h> #include <AK/StringBuilder.h> #include <LibCore/ArgsParser.h> -#include <LibCore/DeprecatedFile.h> #include <LibCore/StandardPaths.h> +#include <LibFileSystem/FileSystem.h> #include <LibLine/Editor.h> #include <LibMain/Main.h> #include <LibSQL/AST/Lexer.h> @@ -365,7 +365,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) SQLRepl repl(loop, database_name, move(sql_client)); - if (!suppress_sqlrc && Core::DeprecatedFile::exists(sqlrc_path)) + if (!suppress_sqlrc && FileSystem::exists(sqlrc_path)) repl.source_file(sqlrc_path); if (!file_to_source.is_empty()) repl.source_file(file_to_source); diff --git a/Userland/Utilities/tar.cpp b/Userland/Utilities/tar.cpp index 44069aa925..58124933e8 100644 --- a/Userland/Utilities/tar.cpp +++ b/Userland/Utilities/tar.cpp @@ -17,6 +17,7 @@ #include <LibCore/DirIterator.h> #include <LibCore/Directory.h> #include <LibCore/System.h> +#include <LibFileSystem/FileSystem.h> #include <LibMain/Main.h> #include <fcntl.h> #include <stdio.h> @@ -278,9 +279,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) Core::DirIterator it(path, Core::DirIterator::Flags::SkipParentAndBaseDir); while (it.has_next()) { auto child_path = it.next_full_path(); - if (!dereference && Core::DeprecatedFile::is_link(child_path)) { + if (!dereference && FileSystem::is_link(child_path)) { TRY(add_link(child_path)); - } else if (!Core::DeprecatedFile::is_directory(child_path)) { + } else if (!FileSystem::is_directory(child_path)) { TRY(add_file(child_path)); } else { TRY(handle_directory(child_path, handle_directory)); @@ -291,7 +292,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) }; for (auto const& path : paths) { - if (Core::DeprecatedFile::is_directory(path)) { + if (FileSystem::is_directory(path)) { TRY(add_directory(path, add_directory)); } else { TRY(add_file(path)); diff --git a/Userland/Utilities/touch.cpp b/Userland/Utilities/touch.cpp index 41ff23113a..8652b4b611 100644 --- a/Userland/Utilities/touch.cpp +++ b/Userland/Utilities/touch.cpp @@ -9,8 +9,8 @@ #include <AK/GenericLexer.h> #include <AK/Time.h> #include <LibCore/ArgsParser.h> -#include <LibCore/DeprecatedFile.h> #include <LibCore/System.h> +#include <LibFileSystem/FileSystem.h> #include <LibMain/Main.h> #include <LibTimeZone/TimeZone.h> #include <ctype.h> @@ -239,7 +239,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) atime.tv_nsec = UTIME_OMIT; for (auto path : paths) { - if (Core::DeprecatedFile::exists(path)) { + if (FileSystem::exists(path)) { if (utimensat(AT_FDCWD, path.characters(), times, 0) == -1) err("failed to touch '{}': {}", path, strerror(errno)); } else if (!no_create_file) { diff --git a/Userland/Utilities/unzip.cpp b/Userland/Utilities/unzip.cpp index 3014ce503a..8d7a36565a 100644 --- a/Userland/Utilities/unzip.cpp +++ b/Userland/Utilities/unzip.cpp @@ -16,6 +16,7 @@ #include <LibCore/MappedFile.h> #include <LibCore/System.h> #include <LibCrypto/Checksum/CRC32.h> +#include <LibFileSystem/FileSystem.h> #include <sys/stat.h> static ErrorOr<void> adjust_modification_time(Archive::ZipMember const& zip_member) @@ -94,7 +95,7 @@ static bool unpack_zip_member(Archive::ZipMember zip_member, bool quiet) if (checksum.digest() != zip_member.crc32) { warnln("Failed decompressing file {}: CRC32 mismatch", zip_member.name); - MUST(Core::DeprecatedFile::remove(zip_member.name, Core::DeprecatedFile::RecursionMode::Disallowed)); + MUST(FileSystem::remove(zip_member.name, FileSystem::RecursionMode::Disallowed)); return false; } diff --git a/Userland/Utilities/userdel.cpp b/Userland/Utilities/userdel.cpp index a2aa9ae5b2..6e9c07f827 100644 --- a/Userland/Utilities/userdel.cpp +++ b/Userland/Utilities/userdel.cpp @@ -10,6 +10,7 @@ #include <LibCore/ArgsParser.h> #include <LibCore/DeprecatedFile.h> #include <LibCore/System.h> +#include <LibFileSystem/FileSystem.h> #include <LibMain/Main.h> #include <unistd.h> @@ -54,7 +55,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) return 12; } - if (auto result = Core::DeprecatedFile::remove(real_path, Core::DeprecatedFile::RecursionMode::Allowed); result.is_error()) { + if (auto result = FileSystem::remove(real_path, FileSystem::RecursionMode::Allowed); result.is_error()) { warnln("{}", result.release_error()); return 12; } diff --git a/Userland/Utilities/watch.cpp b/Userland/Utilities/watch.cpp index 3fe9f3a6c6..db43551a37 100644 --- a/Userland/Utilities/watch.cpp +++ b/Userland/Utilities/watch.cpp @@ -10,9 +10,9 @@ #include <AK/Time.h> #include <AK/Vector.h> #include <LibCore/ArgsParser.h> -#include <LibCore/DeprecatedFile.h> #include <LibCore/FileWatcher.h> #include <LibCore/System.h> +#include <LibFileSystem/FileSystem.h> #include <LibMain/Main.h> #include <errno.h> #include <spawn.h> @@ -165,7 +165,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto file_watcher = Core::BlockingFileWatcher(); for (auto const& file : files_to_watch) { - if (!Core::DeprecatedFile::exists(file)) { + if (!FileSystem::exists(file)) { warnln("Cannot watch '{}', it does not exist.", file); return 1; } diff --git a/Userland/Utilities/zip.cpp b/Userland/Utilities/zip.cpp index b0a7e8c84a..3fe91460a2 100644 --- a/Userland/Utilities/zip.cpp +++ b/Userland/Utilities/zip.cpp @@ -10,11 +10,11 @@ #include <LibCompress/Deflate.h> #include <LibCore/ArgsParser.h> #include <LibCore/DateTime.h> -#include <LibCore/DeprecatedFile.h> #include <LibCore/DirIterator.h> #include <LibCore/File.h> #include <LibCore/System.h> #include <LibCrypto/Checksum/CRC32.h> +#include <LibFileSystem/FileSystem.h> ErrorOr<int> serenity_main(Main::Arguments arguments) { @@ -40,7 +40,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil(nullptr, nullptr)); DeprecatedString zip_file_path { zip_path }; - if (Core::DeprecatedFile::exists(zip_file_path)) { + if (FileSystem::exists(zip_file_path)) { if (force) { outln("{} already exists, overwriting...", zip_file_path); } else { @@ -107,9 +107,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) Core::DirIterator it(path, Core::DirIterator::Flags::SkipParentAndBaseDir); while (it.has_next()) { auto child_path = it.next_full_path(); - if (Core::DeprecatedFile::is_link(child_path)) + if (FileSystem::is_link(child_path)) return {}; - if (!Core::DeprecatedFile::is_directory(child_path)) { + if (!FileSystem::is_directory(child_path)) { auto result = add_file(child_path); if (result.is_error()) warnln("Couldn't add file '{}': {}", child_path, result.error()); @@ -123,7 +123,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) }; for (auto const& source_path : source_paths) { - if (Core::DeprecatedFile::is_directory(source_path)) { + if (FileSystem::is_directory(source_path)) { auto result = add_directory(source_path, add_directory); if (result.is_error()) warnln("Couldn't add directory '{}': {}", source_path, result.error()); |