From 91741afa642b72d28d706cfbf47640f9f7ce58c5 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Fri, 11 Dec 2020 21:46:50 -0500 Subject: [PATCH] Working toward Mac compatability. --- audiogame-manager.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 526b6e3..a15002d 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Dialog accessibility export DIALOGOPTS='--no-lines --visit-items' @@ -28,6 +28,15 @@ update() { fi } +# Function to open urls across OS. +open_url() { + if [[ "$(uname)" == "Darwin" ]]; then + open "${*}" + else + xdg-open "${*}" +fi +} + # Create the clipboard reading function for Sequence Storm write_sequence_storm_reader() { if -e ~/.SequenceStormReader ]]; then @@ -231,11 +240,11 @@ game_removal() { --menu "Please select a game to delete" 0 0 0 "${menuList[@]}" --stdout)" if [[ ${#game} -gt 0 ]]; then if [[ "$game" == "Make a One Time Donation" ]]; then - xdg-open "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=stormdragon2976@gmail.com&lc=US&item_name=Donation+to+Storm+Games&no_note=0&cn=¤cy_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted" + open_url "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=stormdragon2976@gmail.com&lc=US&item_name=Donation+to+Storm+Games&no_note=0&cn=¤cy_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted" exit 0 fi if [[ "$game" == "Become a Patron" ]]; then - xdg-open "https://patreon.com/stormux" + open_url "https://patreon.com/stormux" exit 0 fi local winePath="${game#*|}" @@ -274,11 +283,11 @@ game_launcher() { --menu "Please select a game to play" 0 0 0 "${menuList[@]}" --stdout)" if [[ ${#game} -gt 0 ]]; then if [[ "$game" == "Make a One Time Donation" ]]; then - xdg-open "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=stormdragon2976@gmail.com&lc=US&item_name=Donation+to+Storm+Games&no_note=0&cn=¤cy_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted" + open_url "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=stormdragon2976@gmail.com&lc=US&item_name=Donation+to+Storm+Games&no_note=0&cn=¤cy_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted" exit 0 fi if [[ "$game" == "Become a Patron" ]]; then - xdg-open "https://patreon.com/stormux" + open_url "https://patreon.com/stormux" exit 0 fi # for games that require custom scripts before launch @@ -890,10 +899,10 @@ EOF add_launcher "c:\Program Files\undead_assault\Undead Assault.exe" ;; "Make a One Time Donation") - xdg-open "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=stormdragon2976@gmail.com&lc=US&item_name=Donation+to+Storm+Games&no_note=0&cn=¤cy_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted" + open_url "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=stormdragon2976@gmail.com&lc=US&item_name=Donation+to+Storm+Games&no_note=0&cn=¤cy_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted" ;; "Become a Patron") - xdg-open "https://patreon.com/stormux" + open_url "https://patreon.com/stormux" ;; *) exit 0