From 2b6df4ff82e2dfb88f1dc781c31ed6d5b83c5d38 Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Tue, 24 Jul 2007 11:25:51 +0200 Subject: Main.hs: removed exception Check for default configuration file existence instead. darcs-hash:20070724092551-d6583-5067ca0bf7b95ef3afe846b008cca1077fecc569.gz --- Main.hs | 8 ++++---- 1 file 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 -- cgit v1.2.3