summaryrefslogtreecommitdiffhomepage
path: root/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Main.hs b/Main.hs
index 9715939..dd8baaf 100644
--- a/Main.hs
+++ b/Main.hs
@@ -27,7 +27,7 @@ import Data.IORef
import System.Console.GetOpt
import System.Exit
import System.Environment
-import System.IO.Error
+import System.Posix.Files
-- $main
@@ -57,13 +57,13 @@ readConfig f =
[] -> error ("Corrupt config file: " ++ f)
_ -> error ("Some problem occured. Aborting...")
--- | Read default configuration or quit with an error
+-- | Read default configuration file or load the default config
readDefaultConfig :: IO Config
readDefaultConfig =
do home <- getEnv "HOME"
let path = home ++ "/.xmobarrc"
- catch (readConfig path)
- (\e -> if isUserError e then ioError e else return defaultConfig)
+ f <- fileExist path
+ if f then readConfig path else return defaultConfig
data Opts = Help
| Version