summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@ing.unitn.it>2007-07-24 11:25:51 +0200
committerAndrea Rossato <andrea.rossato@ing.unitn.it>2007-07-24 11:25:51 +0200
commit2b6df4ff82e2dfb88f1dc781c31ed6d5b83c5d38 (patch)
tree364a92567b6cc322755e94169f03db44e5e302f2
parentbfa9857911ad30ffdc1d22f9433eb85143c0d528 (diff)
downloadxmobar-2b6df4ff82e2dfb88f1dc781c31ed6d5b83c5d38.tar.gz
xmobar-2b6df4ff82e2dfb88f1dc781c31ed6d5b83c5d38.tar.bz2
Main.hs: removed exception
Check for default configuration file existence instead. darcs-hash:20070724092551-d6583-5067ca0bf7b95ef3afe846b008cca1077fecc569.gz
-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