From acc64fd98123a54ce4f0ce3379a97af1a3ae6e78 Mon Sep 17 00:00:00 2001 From: OrigamingWasTaken <74014262+OrigamingWasTaken@users.noreply.github.com> Date: Sun, 19 May 2024 01:59:26 +0200 Subject: [PATCH] Check if roblox is installed --- frontend/src/windows/main/App.svelte | 10 +--------- frontend/src/windows/main/ts/roblox.ts | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/frontend/src/windows/main/App.svelte b/frontend/src/windows/main/App.svelte index b956aa9..56dee8b 100644 --- a/frontend/src/windows/main/App.svelte +++ b/frontend/src/windows/main/App.svelte @@ -19,17 +19,9 @@ let ltext = 'Launching...'; async function launchRoblox() { launchingRoblox = true; if (!await hasRoblox()) { - os.execCommand(`osascript <<'END' - set theAlertText to "Roblox is not installed" - set theAlertMessage to "To use AppleBlox, you first need to install Roblox. Would you like to open the download page?" - display alert theAlertText message theAlertMessage as critical buttons {"Cancel", "Open link"} default button "Open link" cancel button "Cancel" giving up after 60 - set the button_pressed to the button returned of the result - if the button_pressed is "Open link" then - open location "https://roblox.com/download" - end if -END`); launchingRoblox = false; } + // Implement launching logic } diff --git a/frontend/src/windows/main/ts/roblox.ts b/frontend/src/windows/main/ts/roblox.ts index 293c8ac..521ce01 100644 --- a/frontend/src/windows/main/ts/roblox.ts +++ b/frontend/src/windows/main/ts/roblox.ts @@ -1,9 +1,19 @@ -import { pathExists } from "./utils"; +import {pathExists} from './utils'; +import {os} from '@neutralinojs/lib'; export async function hasRoblox(): Promise { - if (await pathExists("/Applications/Roblox.app/Contents/MacOS/RobloxPlayer")) { - return true - } else { - return false - } -} \ No newline at end of file + if (await pathExists('/Applications/Roblox.app/Contents/MacOS/RobloxPlayer')) { + return true; + } else { + os.execCommand(`osascript <<'END' + set theAlertText to "Roblox is not installed" + set theAlertMessage to "To use AppleBlox, you first need to install Roblox. Would you like to open the download page?" + display alert theAlertText message theAlertMessage as critical buttons {"Cancel", "Open link"} default button "Open link" cancel button "Cancel" giving up after 60 + set the button_pressed to the button returned of the result + if the button_pressed is "Open link" then + open location "https://roblox.com/download" + end if +END`); + return false; + } +}