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

@ -15,6 +15,7 @@
#include <AK/ScopedValueRollback.h>
#include <AK/StringBuilder.h>
#include <AK/TemporaryChange.h>
#include <AK/URL.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DirIterator.h>
#include <LibCore/Event.h>
@ -66,7 +67,8 @@ void Shell::print_path(const String& path)
printf("%s", path.characters());
return;
}
printf("\033]8;;file://%s%s\033\\%s\033]8;;\033\\", hostname, path.characters(), path.characters());
auto url = URL::create_with_file_scheme(path, {}, hostname);
out("\033]8;;{}\033\\{}\033]8;;\033\\", url.serialize(), path);
}
String Shell::prompt() const