[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36

John Goerzen jgoerzen at complete.org
Fri Apr 23 15:09:12 UTC 2010


The following commit has been merged in the master branch:
commit 92e1fea32851dc5510a6510fa18f7dd58935b9cc
Author: John Goerzen <jgoerzen at complete.org>
Date:   Sat Apr 8 02:31:15 2006 +0100

    New function in HVFS: vDoesExist

diff --git a/MissingH/IO/HVFS.hs b/MissingH/IO/HVFS.hs
index 25b501f..41c3c2b 100644
--- a/MissingH/IO/HVFS.hs
+++ b/MissingH/IO/HVFS.hs
@@ -172,6 +172,8 @@ Default implementations of these functions are provided:
 
  * 'vDoesDirectoryExist' -- implemented in terms of 'vGetFileStatus'
 
+ * 'vDoesExist' -- implemented in terms of 'vGetSymbolicLinkStatus'
+
  * 'vGetSymbolicLinkStatus' -- set to call 'vGetFileStatus'.
 
 Default implementations of all other functions
@@ -190,6 +192,9 @@ class (Show a) => HVFS a where
     vGetDirectoryContents :: a -> FilePath -> IO [FilePath]
     vDoesFileExist :: a -> FilePath -> IO Bool
     vDoesDirectoryExist :: a -> FilePath -> IO Bool
+    {- | True if the file exists, regardless of what type it is.
+       This is even True if the given path is a broken symlink. -}
+    vDoesExist :: a -> FilePath -> IO Bool
     vCreateDirectory :: a -> FilePath -> IO ()
     vRemoveDirectory :: a -> FilePath -> IO ()
     vRenameDirectory :: a -> FilePath -> FilePath -> IO ()
@@ -221,6 +226,10 @@ class (Show a) => HVFS a where
         catch (do s <- vGetFileStatus fs fp
                   return $ withStat s vIsDirectory
               ) (\_ -> return False)
+    vDoesExist fs fp =
+        catch (do s <- vGetSymbolicLinkStatus fs fp
+                  return True
+              ) (\_ -> return False)
     vCreateDirectory fs _ = eh fs "vCreateDirectory"
     vRemoveDirectory fs _ = eh fs "vRemoveDirectory"
     vRemoveFile fs _ = eh fs "vRemoveFile"

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list