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

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
parent 5caaa52bee
commit 628c7f094f
4 changed files with 12 additions and 9 deletions

View file

@ -10,6 +10,7 @@
#include <AK/QuickSort.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/URL.h>
#include <AK/Utf8View.h>
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
@ -196,7 +197,8 @@ static size_t print_name(const struct stat& st, const String& name, const char*
if (!flag_disable_hyperlinks) {
auto full_path = Core::File::real_path_for(path_for_hyperlink);
if (!full_path.is_null()) {
out("\033]8;;file://{}{}\033\\", hostname(), full_path);
auto url = URL::create_with_file_scheme(full_path, {}, hostname());
out("\033]8;;{}\033\\", url.serialize());
}
}