mirror of
https://github.com/RGBCube/serenity
synced 2025-05-29 13:15:08 +00:00
open: Use more StringView instead of const char*
This commit is contained in:
parent
71c004b75f
commit
0dc46da99f
1 changed files with 2 additions and 2 deletions
|
@ -16,7 +16,7 @@
|
||||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
Core::EventLoop loop;
|
Core::EventLoop loop;
|
||||||
Vector<const char*> urls_or_paths;
|
Vector<StringView> urls_or_paths;
|
||||||
Core::ArgsParser parser;
|
Core::ArgsParser parser;
|
||||||
parser.set_general_help("Open a file or URL by executing the appropriate program.");
|
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");
|
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) {
|
for (auto& url_or_path : urls_or_paths) {
|
||||||
auto path = Core::File::real_path_for(url_or_path);
|
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)) {
|
if (!Desktop::Launcher::open(url)) {
|
||||||
warnln("Failed to open '{}'", url);
|
warnln("Failed to open '{}'", url);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue