mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:57:45 +00:00
FileOperation: Use LexicalPath::join() for all path joining
This commit is contained in:
parent
9ac757647f
commit
9122967d5f
1 changed files with 9 additions and 9 deletions
|
@ -87,7 +87,7 @@ static bool collect_copy_work_items(String const& source, String const& destinat
|
||||||
items.append(WorkItem {
|
items.append(WorkItem {
|
||||||
.type = WorkItem::Type::CopyFile,
|
.type = WorkItem::Type::CopyFile,
|
||||||
.source = source,
|
.source = source,
|
||||||
.destination = String::formatted("{}/{}", destination, LexicalPath::basename(source)),
|
.destination = LexicalPath::join(destination, LexicalPath::basename(source)).string(),
|
||||||
.size = st.st_size,
|
.size = st.st_size,
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
@ -97,7 +97,7 @@ static bool collect_copy_work_items(String const& source, String const& destinat
|
||||||
items.append(WorkItem {
|
items.append(WorkItem {
|
||||||
.type = WorkItem::Type::CreateDirectory,
|
.type = WorkItem::Type::CreateDirectory,
|
||||||
.source = {},
|
.source = {},
|
||||||
.destination = String::formatted("{}/{}", destination, LexicalPath::basename(source)),
|
.destination = LexicalPath::join(destination, LexicalPath::basename(source)).string(),
|
||||||
.size = 0,
|
.size = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -105,8 +105,8 @@ static bool collect_copy_work_items(String const& source, String const& destinat
|
||||||
while (dt.has_next()) {
|
while (dt.has_next()) {
|
||||||
auto name = dt.next_path();
|
auto name = dt.next_path();
|
||||||
if (!collect_copy_work_items(
|
if (!collect_copy_work_items(
|
||||||
String::formatted("{}/{}", source, name),
|
LexicalPath::join(source, name).string(),
|
||||||
String::formatted("{}/{}", destination, LexicalPath::basename(source)),
|
LexicalPath::join(destination, LexicalPath::basename(source)).string(),
|
||||||
items)) {
|
items)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ static bool collect_move_work_items(String const& source, String const& destinat
|
||||||
items.append(WorkItem {
|
items.append(WorkItem {
|
||||||
.type = WorkItem::Type::MoveFile,
|
.type = WorkItem::Type::MoveFile,
|
||||||
.source = source,
|
.source = source,
|
||||||
.destination = String::formatted("{}/{}", destination, LexicalPath(source).basename()),
|
.destination = LexicalPath::join(destination, LexicalPath::basename(source)).string(),
|
||||||
.size = st.st_size,
|
.size = st.st_size,
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
@ -151,7 +151,7 @@ static bool collect_move_work_items(String const& source, String const& destinat
|
||||||
items.append(WorkItem {
|
items.append(WorkItem {
|
||||||
.type = WorkItem::Type::CreateDirectory,
|
.type = WorkItem::Type::CreateDirectory,
|
||||||
.source = {},
|
.source = {},
|
||||||
.destination = String::formatted("{}/{}", destination, LexicalPath(source).basename()),
|
.destination = LexicalPath::join(destination, LexicalPath::basename(source)).string(),
|
||||||
.size = 0,
|
.size = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -159,8 +159,8 @@ static bool collect_move_work_items(String const& source, String const& destinat
|
||||||
while (dt.has_next()) {
|
while (dt.has_next()) {
|
||||||
auto name = dt.next_path();
|
auto name = dt.next_path();
|
||||||
if (!collect_move_work_items(
|
if (!collect_move_work_items(
|
||||||
String::formatted("{}/{}", source, name),
|
LexicalPath::join(source, name).string(),
|
||||||
String::formatted("{}/{}", destination, LexicalPath(source).basename()),
|
LexicalPath::join(destination, LexicalPath::basename(source)).string(),
|
||||||
items)) {
|
items)) {
|
||||||
return false;
|
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);
|
Core::DirIterator dt(source, Core::DirIterator::SkipParentAndBaseDir);
|
||||||
while (dt.has_next()) {
|
while (dt.has_next()) {
|
||||||
auto name = dt.next_path();
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue