mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-03 00:36:52 +03:00
open: Use more StringView instead of const char*
This commit is contained in:
parent
71c004b75f
commit
0dc46da99f
Notes:
sideshowbarker
2024-07-17 19:56:50 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/0dc46da99f7 Pull-request: https://github.com/SerenityOS/serenity/pull/12221
@ -16,7 +16,7 @@
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
Core::EventLoop loop;
|
||||
Vector<const char*> urls_or_paths;
|
||||
Vector<StringView> urls_or_paths;
|
||||
Core::ArgsParser parser;
|
||||
parser.set_general_help("Open a file or URL by executing the appropriate program.");
|
||||
parser.add_positional_argument(urls_or_paths, "URL or file path to open", "url-or-path");
|
||||
@ -26,7 +26,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
|
||||
for (auto& url_or_path : urls_or_paths) {
|
||||
auto path = Core::File::real_path_for(url_or_path);
|
||||
auto url = URL::create_with_url_or_path(path.is_null() ? url_or_path : path);
|
||||
auto url = URL::create_with_url_or_path(path.is_null() ? url_or_path : path.view());
|
||||
|
||||
if (!Desktop::Launcher::open(url)) {
|
||||
warnln("Failed to open '{}'", url);
|
||||
|
Loading…
Reference in New Issue
Block a user