From 1a7c345d3d530c566840c72f59a932f292cefd09 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Wed, 17 Feb 2021 16:01:53 +0100 Subject: Initial --- Coolbal/Directory.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Coolbal/Directory.hs (limited to 'Coolbal/Directory.hs') diff --git a/Coolbal/Directory.hs b/Coolbal/Directory.hs new file mode 100644 index 0000000..c2a53cc --- /dev/null +++ b/Coolbal/Directory.hs @@ -0,0 +1,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" -- cgit v1.2.3-70-g09d2