1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 21:27:34 +00:00

mv: Prefer FileSystem over DeprecatedFile

This commit is contained in:
Ben Wiederhake 2023-05-13 13:33:09 +02:00 committed by Jelle Raaijmakers
parent 02fa97a13f
commit 54b3f90e47

View file

@ -7,7 +7,6 @@
#include <AK/DeprecatedString.h> #include <AK/DeprecatedString.h>
#include <AK/LexicalPath.h> #include <AK/LexicalPath.h>
#include <LibCore/ArgsParser.h> #include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/System.h> #include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h> #include <LibFileSystem/FileSystem.h>
#include <LibMain/Main.h> #include <LibMain/Main.h>
@ -76,14 +75,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
rc = rename(old_path.characters(), new_path.characters()); rc = rename(old_path.characters(), new_path.characters());
if (rc < 0) { if (rc < 0) {
if (errno == EXDEV) { if (errno == EXDEV) {
auto result = Core::DeprecatedFile::copy_file_or_directory( auto result = FileSystem::copy_file_or_directory(
new_path, old_path, new_path, old_path,
Core::DeprecatedFile::RecursionMode::Allowed, FileSystem::RecursionMode::Allowed,
Core::DeprecatedFile::LinkMode::Disallowed, FileSystem::LinkMode::Disallowed,
Core::DeprecatedFile::AddDuplicateFileMarker::No); FileSystem::AddDuplicateFileMarker::No);
if (result.is_error()) { if (result.is_error()) {
warnln("mv: could not move '{}': {}", old_path, static_cast<Error const&>(result.error())); warnln("mv: could not move '{}': {}", old_path, result.error());
return 1; return 1;
} }
rc = unlink(old_path.characters()); rc = unlink(old_path.characters());