LibGUI+Shell+bt+ls: Use proper APIs for creating file URLs

This patch replaces ad-hoc generation of file URL strings with using
URL::create_with_file_scheme().
This commit is contained in:
Max Wipfli 2021-05-29 23:15:54 +02:00 committed by Andreas Kling
commit 628c7f094f
Notes: sideshowbarker 2024-07-18 17:03:38 +09:00
4 changed files with 12 additions and 9 deletions

View file

@ -439,12 +439,8 @@ Variant FileSystemModel::data(const ModelIndex& index, ModelRole role) const
}
if (role == ModelRole::MimeData) {
if (index.column() == Column::Name) {
StringBuilder builder;
builder.append("file://");
builder.append(node.full_path());
return builder.to_string();
}
if (index.column() == Column::Name)
return URL::create_with_file_scheme(node.full_path()).serialize();
return {};
}