summaryrefslogtreecommitdiff
path: root/Userland/Utilities
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2023-05-20 10:43:37 +0200
committerAndreas Kling <kling@serenityos.org>2023-05-21 07:50:52 +0200
commit6055eed5a585e6e46c4e192ef36626925c44a2c2 (patch)
treebb9330950d4d686e69f1a134b3c7a8e598043d16 /Userland/Utilities
parent9e755ccfef4d45d3ae6b48731a7fe49b94a3db60 (diff)
downloadserenity-6055eed5a585e6e46c4e192ef36626925c44a2c2.zip
xml: Prefer LibFileSystem over DeprecatedFile
Diffstat (limited to 'Userland/Utilities')
-rw-r--r--Userland/Utilities/CMakeLists.txt2
-rw-r--r--Userland/Utilities/xml.cpp10
2 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt
index 60d5c735ab..19efb00005 100644
--- a/Userland/Utilities/CMakeLists.txt
+++ b/Userland/Utilities/CMakeLists.txt
@@ -152,7 +152,7 @@ target_link_libraries(wasm PRIVATE LibFileSystem LibJS LibLine LibWasm)
target_link_libraries(watch PRIVATE LibFileSystem)
target_link_libraries(which PRIVATE LibFileSystem)
target_link_libraries(wsctl PRIVATE LibGUI LibIPC)
-target_link_libraries(xml PRIVATE LibXML)
+target_link_libraries(xml PRIVATE LibFileSystem LibXML)
target_link_libraries(xzcat PRIVATE LibCompress)
target_link_libraries(zip PRIVATE LibArchive LibCompress LibCrypto LibFileSystem)
diff --git a/Userland/Utilities/xml.cpp b/Userland/Utilities/xml.cpp
index 65fb0d4aa0..8097c17f24 100644
--- a/Userland/Utilities/xml.cpp
+++ b/Userland/Utilities/xml.cpp
@@ -9,8 +9,8 @@
#include <AK/URL.h>
#include <AK/URLParser.h>
#include <LibCore/ArgsParser.h>
-#include <LibCore/DeprecatedFile.h>
#include <LibCore/File.h>
+#include <LibFileSystem/FileSystem.h>
#include <LibMain/Main.h>
#include <LibXML/DOM/Document.h>
#include <LibXML/DOM/Node.h>
@@ -355,7 +355,7 @@ static void dump(XML::Document& document)
dump(document.root());
}
-static DeprecatedString s_path;
+static String s_path;
static auto parse(StringView contents)
{
return XML::Parser {
@@ -363,7 +363,7 @@ static auto parse(StringView contents)
{
.preserve_comments = true,
.resolve_external_resource = [&](XML::SystemID const& system_id, Optional<XML::PublicID> const&) -> ErrorOr<DeprecatedString> {
- auto base = URL::create_with_file_scheme(s_path);
+ auto base = URL::create_with_file_scheme(s_path.to_deprecated_string());
auto url = URLParser::parse(system_id.system_literal, base);
if (!url.is_valid())
return Error::from_string_literal("Invalid URL");
@@ -402,7 +402,7 @@ static void do_run_tests(XML::Document& document)
dump_cases(root);
- auto base_path = LexicalPath::dirname(s_path);
+ auto base_path = LexicalPath::dirname(s_path.to_deprecated_string());
while (!suites.is_empty()) {
auto& node = *suites.dequeue();
@@ -516,7 +516,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
parser.add_positional_argument(filename, "File to read from", "file");
parser.parse(arguments);
- s_path = Core::DeprecatedFile::real_path_for(filename);
+ s_path = TRY(FileSystem::real_path(filename));
auto file = TRY(Core::File::open(s_path, Core::File::OpenMode::Read));
auto contents = TRY(file->read_until_eof());