{-# LANGUAGE CPP #-}

module Test.Sandwich.WebDriver.Internal.Binaries.DetectPlatform (
  detectPlatform
  , Platform(..)
  ) where

import Data.String.Interpolate
import qualified System.Info as SI


data Platform = Linux | OSX | Windows deriving (Int -> Platform -> ShowS
[Platform] -> ShowS
Platform -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Platform] -> ShowS
$cshowList :: [Platform] -> ShowS
show :: Platform -> String
$cshow :: Platform -> String
showsPrec :: Int -> Platform -> ShowS
$cshowsPrec :: Int -> Platform -> ShowS
Show, Platform -> Platform -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Platform -> Platform -> Bool
$c/= :: Platform -> Platform -> Bool
== :: Platform -> Platform -> Bool
$c== :: Platform -> Platform -> Bool
Eq)

detectPlatform :: Platform
detectPlatform :: Platform
detectPlatform = case String
SI.os of
  String
"windows" -> Platform
Windows
  String
"linux" -> Platform
Linux
  String
"darwin" -> Platform
OSX
  String
_ -> forall a. HasCallStack => String -> a
error [i|Couldn't determine host platform from string: '#{SI.os}'|]