install: Prefer FileSystem over DeprecatedFile

This commit is contained in:
Ben Wiederhake 2023-05-13 13:23:30 +02:00 committed by Jelle Raaijmakers
parent 5031603cdc
commit 6c9383ce89
Notes: sideshowbarker 2024-07-16 22:34:39 +09:00
2 changed files with 7 additions and 6 deletions

View file

@ -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)

View file

@ -7,10 +7,10 @@
#include <AK/LexicalPath.h>
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
#include <LibCore/FilePermissionsMask.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
#include <LibMain/Main.h>
ErrorOr<int> serenity_main(Main::Arguments arguments)
@ -35,8 +35,8 @@ ErrorOr<int> 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<int> 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)));