Skip to content

Commit

Permalink
Ladybird: Use FileSystem instead of DeprecatedFile
Browse files Browse the repository at this point in the history
  • Loading branch information
cammo1123 authored and ADKaster committed Apr 10, 2023
1 parent 7734eba commit 97cc2b3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Ladybird/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <Browser/CookieJar.h>
#include <Browser/Database.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
Expand Down Expand Up @@ -75,10 +74,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.add_option(webdriver_content_ipc_path, "Path to WebDriver IPC for WebContent", "webdriver-content-path", 0, "path");
args_parser.parse(arguments);

auto get_formatted_url = [&](StringView const& raw_url) -> URL {
auto get_formatted_url = [&](StringView const& raw_url) -> ErrorOr<URL> {
URL url = raw_url;
if (FileSystem::exists(raw_url))
url = URL::create_with_file_scheme(Core::DeprecatedFile::real_path_for(raw_url));
url = URL::create_with_file_scheme(TRY(FileSystem::real_path(raw_url)).to_deprecated_string());
else if (!url.is_valid())
url = DeprecatedString::formatted("http:https://{}", raw_url);
return url;
Expand All @@ -96,11 +95,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window.resize(800, 600);
window.show();

if (auto url = get_formatted_url(raw_url); url.is_valid()) {
if (auto url = TRY(get_formatted_url(raw_url)); url.is_valid()) {
window.view().load(url);
} else if (!s_settings->homepage().isEmpty()) {
auto home_url = TRY(ak_string_from_qstring(s_settings->homepage()));
window.view().load(get_formatted_url(home_url.bytes_as_string_view()));
window.view().load(TRY(get_formatted_url(home_url.bytes_as_string_view())));
}

return app.exec();
Expand Down

0 comments on commit 97cc2b3

Please sign in to comment.