Skip to content

Commit

Permalink
Check if roblox is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
OrigamingWasTaken committed May 18, 2024
1 parent 381cd6f commit acc64fd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
10 changes: 1 addition & 9 deletions frontend/src/windows/main/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
</script>
Expand Down
24 changes: 17 additions & 7 deletions frontend/src/windows/main/ts/roblox.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import { pathExists } from "./utils";
import {pathExists} from './utils';
import {os} from '@neutralinojs/lib';

export async function hasRoblox(): Promise<boolean> {
if (await pathExists("/Applications/Roblox.app/Contents/MacOS/RobloxPlayer")) {
return true
} else {
return false
}
}
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;
}
}

0 comments on commit acc64fd

Please sign in to comment.