macos support

This commit is contained in:
Joey Eamigh
2023-06-22 13:39:56 -04:00
parent 93409a83f8
commit a38910cbaf
3 changed files with 27 additions and 19 deletions

View File

@@ -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
}
}
if (Test-Path ".venv") { } else { python -m venv .venv }
if (-not (Test-Path ".venv")) { python -m venv .venv }
. .\.venv\Scripts\Activate.ps1

View File

@@ -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():

View File

@@ -12,10 +12,19 @@ if ! [ -x "$(command -v java)" ]; then
exit 1
fi
# check that multimc is installed
if ! [ -x "$(command -v multimc)" ]; then
# 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