diff --git a/client/client.ps1 b/client/client.ps1 index 5ea4cd7..b2f9d20 100755 --- a/client/client.ps1 +++ b/client/client.ps1 @@ -3,27 +3,22 @@ $winget = Get-Command winget -ErrorAction SilentlyContinue if (!$winget) { Write-Host "Error: winget is not installed." -Foreground Red - Write-Host "This script probably will not work without winget." -Foreground Red - Write-Host "Run 'Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe' and then search for 'App Installer' on the Microsoft Store to install winget." -Foreground Red - Write-Host "If you do install winget, this script should handle the rest." -Foreground Red + Write-Host "This script will not work without winget." -Foreground Red + Write-Host "Please install winget - trying to open Microsoft Store" -Foreground Yellow + Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe + Start-Process "ms-windows-store://pdp/?ProductId=9NBLGGH4NNS1" + exit 1 } # Check that java is installed if (-not (Get-Command "C:\Program Files\AdoptOpenJDK\jdk-11.0.11.9-hotspot\bin\java" -ErrorAction SilentlyContinue)) { Write-Host "Error: java is not installed." -Foreground Red - if ($winget) { - Write-Host "Attempting to install java." - winget install AdoptOpenJDK.OpenJDK.11 - } - else { - Write-Host "Please install java to continue." -Foreground Red - exit 1 - } - + Write-Host "Attempting to install java." + winget install AdoptOpenJDK.OpenJDK.11 } -if (Test-Path ".venv") { } else { python -m venv .venv } +if (-not (Test-Path ".venv")) { python -m venv .venv } . .\.venv\Scripts\Activate.ps1 diff --git a/client/client.py b/client/client.py index b27ef14..03b2608 100644 --- a/client/client.py +++ b/client/client.py @@ -16,8 +16,9 @@ MULTIMC_DIR = "" INSTANCE_DIR = "" if OS == "darwin": - cprint("no support for macos yet", "red") - exit(1) + MULTIMC_PARENT_DIR = "/Applications/MultiMC.app" + MULTIMC_DIR = f"{MULTIMC_PARENT_DIR}/Data" + INSTANCE_DIR = f"{MULTIMC_DIR}/instances/FishPogPixelmon" if OS == "linux": MULTIMC_PARENT_DIR = f"{os.getenv('HOME')}/.local/share" @@ -51,6 +52,9 @@ def run_mmc(): if OS == "linux": subprocess.Popen(["./MultiMC"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + if OS == "darwin": + subprocess.Popen(["open", "-a", "MultiMC"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + # mods def mods(): diff --git a/client/client.sh b/client/client.sh index abd3a3a..edc47f6 100755 --- a/client/client.sh +++ b/client/client.sh @@ -12,10 +12,19 @@ if ! [ -x "$(command -v java)" ]; then exit 1 fi -# check that multimc is installed -if ! [ -x "$(command -v multimc)" ]; then - echo 'Error: multimc is not installed. Please install it to continue.' >&2 - exit 1 +# check if is macos or linux +if [[ "$OSTYPE" == "linux"* ]]; then + # check that multimc is installed + if ! [ -x "$(command -v multimc)" ]; then + echo 'Error: multimc is not installed. Please install it to continue.' >&2 + exit 1 + fi +elif [[ "$OSTYPE" == "darwin"* ]]; then + # check that MultiMC.app is in /Applications + if ! [ -d "/Applications/MultiMC.app" ]; then + echo 'Error: MultiMC.app is not installed. Please install it to continue.' >&2 + exit 1 + fi fi if ! [ -d .venv ]; then python -m venv .venv; fi