From 6c9383ce89d396684240d995513cdacc4850bb97 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sat, 13 May 2023 13:23:30 +0200 Subject: [PATCH] install: Prefer FileSystem over DeprecatedFile --- Userland/Utilities/CMakeLists.txt | 1 + Userland/Utilities/install.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt index cc4f9b34183..e2d3d658052 100644 --- a/Userland/Utilities/CMakeLists.txt +++ b/Userland/Utilities/CMakeLists.txt @@ -100,6 +100,7 @@ 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(install-bin 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) diff --git a/Userland/Utilities/install.cpp b/Userland/Utilities/install.cpp index 8afe3f50a41..2c2ef4478f7 100644 --- a/Userland/Utilities/install.cpp +++ b/Userland/Utilities/install.cpp @@ -7,10 +7,10 @@ #include #include #include -#include #include #include #include +#include #include ErrorOr serenity_main(Main::Arguments arguments) @@ -35,8 +35,8 @@ ErrorOr serenity_main(Main::Arguments arguments) DeprecatedString destination_dir = (sources.size() > 1 ? DeprecatedString { destination } : LexicalPath::dirname(destination)); if (create_leading_dest_components) { - DeprecatedString destination_dir_absolute = Core::DeprecatedFile::absolute_path(destination_dir); - MUST(Core::Directory::create(destination_dir_absolute, Core::Directory::CreateDirectories::Yes)); + String destination_dir_absolute = TRY(FileSystem::absolute_path(destination_dir)); + MUST(Core::Directory::create(destination_dir_absolute.to_deprecated_string(), Core::Directory::CreateDirectories::Yes)); } for (auto const& source : sources) { @@ -47,9 +47,9 @@ ErrorOr serenity_main(Main::Arguments arguments) final_destination = destination; } - TRY(Core::DeprecatedFile::copy_file_or_directory(final_destination, source, Core::DeprecatedFile::RecursionMode::Allowed, - Core::DeprecatedFile::LinkMode::Disallowed, Core::DeprecatedFile::AddDuplicateFileMarker::No, - Core::DeprecatedFile::PreserveMode::Nothing)); + TRY(FileSystem::copy_file_or_directory(final_destination, source, FileSystem::RecursionMode::Allowed, + FileSystem::LinkMode::Disallowed, FileSystem::AddDuplicateFileMarker::No, + FileSystem::PreserveMode::Nothing)); auto current_access = TRY(Core::System::stat(final_destination)); TRY(Core::System::chmod(final_destination, permission_mask.apply(current_access.st_mode)));