diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2023-05-20 01:35:18 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-05-21 07:50:52 +0200 |
commit | 34eb7970138fed0ed0fc0c7ecb5a21db05e55295 (patch) | |
tree | 3f000cf180690b69cf53b4cb330a3ea48b097828 | |
parent | 0420e12dad380acbaf2ace4b6b4451db25c07b42 (diff) | |
download | serenity-34eb7970138fed0ed0fc0c7ecb5a21db05e55295.zip |
markdown-check: Prefer LibFileSystem and String over Deprecated*
-rw-r--r-- | Userland/Utilities/markdown-check.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Userland/Utilities/markdown-check.cpp b/Userland/Utilities/markdown-check.cpp index 0115f9c07e..8f4bea4679 100644 --- a/Userland/Utilities/markdown-check.cpp +++ b/Userland/Utilities/markdown-check.cpp @@ -19,7 +19,6 @@ #include <AK/URL.h> #include <AK/Vector.h> #include <LibCore/ArgsParser.h> -#include <LibCore/DeprecatedFile.h> #include <LibCore/File.h> #include <LibFileSystem/FileSystem.h> #include <LibMain/Main.h> @@ -27,7 +26,7 @@ #include <LibMarkdown/Visitor.h> #include <stdlib.h> -static bool is_missing_file_acceptable(DeprecatedString const& filename) +static bool is_missing_file_acceptable(String const& filename) { const StringView acceptable_missing_files[] = { // FIXME: Please write these manpages! @@ -55,7 +54,7 @@ static bool is_missing_file_acceptable(DeprecatedString const& filename) "index.html"sv, }; for (auto const& suffix : acceptable_missing_files) { - if (filename.ends_with(suffix)) + if (filename.ends_with_bytes(suffix)) return true; } return false; @@ -249,7 +248,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.parse(arguments); outln("Reading and parsing Markdown files ..."); - HashMap<DeprecatedString, MarkdownLinkage> files; + HashMap<String, MarkdownLinkage> files; for (auto path : file_paths) { auto file_or_error = Core::File::open(path, Core::File::OpenMode::Read); if (file_or_error.is_error()) { @@ -274,7 +273,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) // Since this should never happen anyway, fail early. return 1; } - files.set(Core::DeprecatedFile::real_path_for(path), MarkdownLinkage::analyze(*document)); + files.set(TRY(FileSystem::real_path(path)), MarkdownLinkage::analyze(*document)); } outln("Checking links ..."); @@ -286,14 +285,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) continue; } - auto file_lexical_path = LexicalPath(file_item.key); + auto file_lexical_path = LexicalPath(file_item.key.to_deprecated_string()); auto file_dir = file_lexical_path.dirname(); for (auto const& file_link : file_item.value.file_links()) { - DeprecatedString pointee_file; + String pointee_file; if (file_link.file_path.is_empty()) { pointee_file = file_item.key; } else { - pointee_file = LexicalPath::absolute_path(file_dir, file_link.file_path); + pointee_file = TRY(String::from_deprecated_string(LexicalPath::absolute_path(file_dir, file_link.file_path))); } if (!FileSystem::exists(pointee_file) && !is_missing_file_acceptable(pointee_file)) { outln("File '{}' points to '{}' (label '{}'), but '{}' does not exist!", |