Skip to content

Commit

Permalink
use BUrl for opening github and the user guide
Browse files Browse the repository at this point in the history
  • Loading branch information
augiedoggie committed Jul 7, 2024
1 parent 9d610ca commit 4259477
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions Source/RunnerAddOn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <PathFinder.h>
#include <Roster.h>
#include <TrackerAddOn.h>
#include <Url.h>
#include <private/shared/CommandPipe.h>

#ifdef USE_MENUITEM_ICONS
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 4259477

Please sign in to comment.