diff options
Diffstat (limited to 'UVtools.WPF/UVtools.sh')
-rw-r--r-- | UVtools.WPF/UVtools.sh | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/UVtools.WPF/UVtools.sh b/UVtools.WPF/UVtools.sh index e4516b4..14446f6 100644 --- a/UVtools.WPF/UVtools.sh +++ b/UVtools.WPF/UVtools.sh @@ -1,3 +1,34 @@ #!/bin/bash -cd "$(dirname "$0")" -[ -f UVtools ] && ./UVtools || dotnet UVtools.dll +path="$(dirname "$0")" +arch="$(uname -m)" # x86_64 or arm64 + +run_app_normal(){ + "$path/UVtools" +} + +run_app_dotnet(){ + if [ -z "$(command -v dotnet)" ]; then + echo "$(uname) $arch requires dotnet in order to run." + echo 'Please use the auto installer script to install all the dependencies.' + exit -1 + fi + + if [ -f "$path/UVtools.dll" ]; then + dotnet "$path/UVtools.dll" + else + echo "Error: UVtools.dll not found." + exit -1 + fi +} + +if [ "${OSTYPE:0:6}" == "darwin" -a "$arch" == "arm64" ]; then + run_app_dotnet +elif [ -f "$path/UVtools" ]; then + run_app_normal +elif [ -f "$path/UVtools.dll" ]; then + run_app_dotnet +else + echo 'Error: Unable to detect UVtools or to run it.' + echo 'Please use the auto installer script to re/install UVtools.' + exit -1 +fi |