summaryrefslogtreecommitdiff
path: root/Coolbal/Directory.hs
blob: c2a53cce673e5cae481c7dec75ae281e6abc5c5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
module Coolbal.Directory where

import System.Environment (lookupEnv)
import System.Exit (die)
import System.IO.Unsafe (unsafePerformIO)


currentHomeDirectory :: String
currentHomeDirectory = unsafePerformIO $ do
    var <- lookupEnv "HOME"
    case var of
      Just s -> return s
      Nothing -> die "Cannot get home directory from $HOME environment variable"