From 42594773841b5ed75af80146c7daf124e46d6b1d Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Sat, 6 Jul 2024 20:43:19 -0600 Subject: [PATCH] use BUrl for opening github and the user guide --- Source/RunnerAddOn.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Source/RunnerAddOn.cpp b/Source/RunnerAddOn.cpp index 11006ce..54eb0d3 100644 --- a/Source/RunnerAddOn.cpp +++ b/Source/RunnerAddOn.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #ifdef USE_MENUITEM_ICONS @@ -145,10 +146,8 @@ RunnerAddOn::OpenUserGuide(bool useAppImage) indexLocation.SetTo(list.First()); } - const char* args[] = {indexLocation.Path(), NULL}; - - status_t rc = be_roster->Launch("application/x-vnd.Be.URL.https", 1, args); - if (rc != B_OK && rc != B_ALREADY_RUNNING) { + status_t rc = BUrl(indexLocation).OpenWithPreferredApplication(); + if (rc != B_OK) { (new BAlert("Error", B_TRANSLATE("Failed to launch URL"), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); return rc; @@ -318,15 +317,11 @@ message_received(BMessage* message) RunnerAddOn::OpenUserGuide(); break; case kGithubWhat: - { - const char* args[] = {kGithubUrl, NULL}; - status_t rc = be_roster->Launch("application/x-vnd.Be.URL.https", 1, args); - if (rc != B_OK && rc != B_ALREADY_RUNNING) { + if (BUrl(kGithubUrl).OpenWithPreferredApplication() != B_OK) { (new BAlert("Error", B_TRANSLATE("Failed to launch URL"), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); } break; - } default: break; }