diff options
author | Tom Smeding <tom@tomsmeding.com> | 2021-02-17 16:01:53 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2021-02-17 16:01:53 +0100 |
commit | 1a7c345d3d530c566840c72f59a932f292cefd09 (patch) | |
tree | a9a5d4d96b6ae0fcd0f632f427b52ed0c9fe954a /Coolbal/Directory.hs |
Initial
Diffstat (limited to 'Coolbal/Directory.hs')
-rw-r--r-- | Coolbal/Directory.hs | 13 |
1 files changed, 13 insertions, 0 deletions
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" |