diff options
author | Sam Atkins <atkinssj@gmail.com> | 2021-06-24 16:48:51 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-22 12:48:44 +0200 |
commit | 9122967d5f3531582b43ea390c02202bdd9609b6 (patch) | |
tree | 5b18e95ce2320de1a70a0dd5eb1a00001ddffb8a /Userland/Services | |
parent | 9ac757647f259c7e38b243d347c573e05fb0bd75 (diff) | |
download | serenity-9122967d5f3531582b43ea390c02202bdd9609b6.zip |
FileOperation: Use LexicalPath::join() for all path joining
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/FileOperation/main.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Userland/Services/FileOperation/main.cpp b/Userland/Services/FileOperation/main.cpp index 829ad6803d..96ec507151 100644 --- a/Userland/Services/FileOperation/main.cpp +++ b/Userland/Services/FileOperation/main.cpp @@ -87,7 +87,7 @@ static bool collect_copy_work_items(String const& source, String const& destinat items.append(WorkItem { .type = WorkItem::Type::CopyFile, .source = source, - .destination = String::formatted("{}/{}", destination, LexicalPath::basename(source)), + .destination = LexicalPath::join(destination, LexicalPath::basename(source)).string(), .size = st.st_size, }); return true; @@ -97,7 +97,7 @@ static bool collect_copy_work_items(String const& source, String const& destinat items.append(WorkItem { .type = WorkItem::Type::CreateDirectory, .source = {}, - .destination = String::formatted("{}/{}", destination, LexicalPath::basename(source)), + .destination = LexicalPath::join(destination, LexicalPath::basename(source)).string(), .size = 0, }); @@ -105,8 +105,8 @@ static bool collect_copy_work_items(String const& source, String const& destinat while (dt.has_next()) { auto name = dt.next_path(); if (!collect_copy_work_items( - String::formatted("{}/{}", source, name), - String::formatted("{}/{}", destination, LexicalPath::basename(source)), + LexicalPath::join(source, name).string(), + LexicalPath::join(destination, LexicalPath::basename(source)).string(), items)) { return false; } @@ -141,7 +141,7 @@ static bool collect_move_work_items(String const& source, String const& destinat items.append(WorkItem { .type = WorkItem::Type::MoveFile, .source = source, - .destination = String::formatted("{}/{}", destination, LexicalPath(source).basename()), + .destination = LexicalPath::join(destination, LexicalPath::basename(source)).string(), .size = st.st_size, }); return true; @@ -151,7 +151,7 @@ static bool collect_move_work_items(String const& source, String const& destinat items.append(WorkItem { .type = WorkItem::Type::CreateDirectory, .source = {}, - .destination = String::formatted("{}/{}", destination, LexicalPath(source).basename()), + .destination = LexicalPath::join(destination, LexicalPath::basename(source)).string(), .size = 0, }); @@ -159,8 +159,8 @@ static bool collect_move_work_items(String const& source, String const& destinat while (dt.has_next()) { auto name = dt.next_path(); if (!collect_move_work_items( - String::formatted("{}/{}", source, name), - String::formatted("{}/{}", destination, LexicalPath(source).basename()), + LexicalPath::join(source, name).string(), + LexicalPath::join(destination, LexicalPath::basename(source)).string(), items)) { return false; } @@ -212,7 +212,7 @@ static bool collect_delete_work_items(String const& source, Vector<WorkItem>& it Core::DirIterator dt(source, Core::DirIterator::SkipParentAndBaseDir); while (dt.has_next()) { auto name = dt.next_path(); - if (!collect_delete_work_items(String::formatted("{}/{}", source, name), items)) + if (!collect_delete_work_items(LexicalPath::join(source, name).string(), items)) return false; } |