[nicer function for loading a file
martin.hofmann@uni-bamberg.de**20090416130138] hunk ./src/UI/UIStarter.hs 105
-runCmd s (Load path) = do 
-    ok <- typecheck path    
-    if ok 
-      then do ctx <- parseContext (context s) path
-              return $ ctx `seq` (False,s{context=ctx})
-      else return (False, s)   
-        
-    
+runCmd s (Load path)  =  loadFile s path
hunk ./src/UI/UIStarter.hs 160
-loadBatch s name = do
-    file <- readFile name
-    foldUntil eval s $ lines $ stripComments file
+loadBatch s path = do
+    exists <- doesFileExist path 
+    if exists 
+      then do file <- readFile path
+              foldUntil eval s $ lines $ stripComments file
+      else cancel s path
+      
+loadFile :: EnvState -> String -> IO (Bool, EnvState)
+loadFile s path = do
+    exists <- doesFileExist path 
+    if exists 
+      then do ok <- (typecheck  path) 
+              if ok 
+                 then do ctx <- parseContext (context s) path
+                         return $ ctx `seq` (False,s{context=ctx})
+                 else cancel s path
+      else cancel s path
+      
+cancel s path = do putStrLn ("Failed to load file: " ++ path ++ 
+                             "! File not found!")
+                   return (False,s)       
+          