From 9d5770544e8707352176b5546514dadc10863792 Mon Sep 17 00:00:00 2001
From: Thomas O'Donnell <andytom@users.noreply.github.com>
Date: Sun, 25 Oct 2020 10:16:47 +0100
Subject: [PATCH] fix(install): Better platform detection (#1827)

Have refactored the platform detection in the install script to try to
better detect Windows when running the Windows install script.
---
 install/install.sh | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/install/install.sh b/install/install.sh
index 5b091cb2e..c14d3b9e0 100755
--- a/install/install.sh
+++ b/install/install.sh
@@ -170,19 +170,14 @@ detect_platform() {
   local platform
   platform="$(uname -s | tr '[:upper:]' '[:lower:]')"
 
-  # mingw is Git-Bash
-  if echo "${platform}" | grep -i mingw >/dev/null; then
-    platform=pc-windows-msvc
-  fi
-
-  if [ "${platform}" = "linux" ]; then
+  case "${platform}" in
+    msys_nt*) platform="pc-windows-msvc" ;;
+    # mingw is Git-Bash
+    mingw*) platform="pc-windows-msvc" ;;
     # use the statically compiled musl bins on linux to avoid linking issues.
-    platform=unknown-linux-musl
-  fi
-
-  if [ "${platform}" = "darwin" ]; then
-    platform=apple-darwin
-  fi
+    linux) platform="unknown-linux-musl" ;;
+    darwin) platform="apple-darwin" ;;
+  esac
 
   echo "${platform}"
 }