[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 14:53:45 UTC 2010


The following commit has been merged in the master branch:
commit 3b9980daab2f56477e3b75d14054368e17d5c14d
Author: John Goerzen <jgoerzen at complete.org>
Date:   Fri Dec 24 00:21:02 2004 +0100

    Added size to the simple stat info
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--0.7--patch-155)

diff --git a/ChangeLog b/ChangeLog
index ab92fbe..e32ef68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,19 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.7
 #
 
+2004-12-23 17:21:02 GMT	John Goerzen <jgoerzen at complete.org>	patch-155
+
+    Summary:
+      Added size to the simple stat info
+    Revision:
+      missingh--head--0.7--patch-155
+
+
+    modified files:
+     ChangeLog libsrc/MissingH/IO/HVFS.hs
+     libsrc/MissingH/IO/HVFS/InstanceHelpers.hs
+
+
 2004-12-23 17:11:12 GMT	John Goerzen <jgoerzen at complete.org>	patch-154
 
     Summary:
diff --git a/libsrc/MissingH/IO/HVFS.hs b/libsrc/MissingH/IO/HVFS.hs
index 30d05a1..1fe818f 100644
--- a/libsrc/MissingH/IO/HVFS.hs
+++ b/libsrc/MissingH/IO/HVFS.hs
@@ -118,7 +118,7 @@ class (Show a) => HVFSStat a where
 
     vDeviceID _ = 0
     vFileID _ = 0
-    vFileMode _ = 0o0644
+    vFileMode x = if vIsDirectory x then 0x755 else 0o0644
     vLinkCount _ = 1
     vFileOwner _ = 0
     vFileGroup _ = 0
diff --git a/libsrc/MissingH/IO/HVFS/InstanceHelpers.hs b/libsrc/MissingH/IO/HVFS/InstanceHelpers.hs
index c019d2f..e33b98d 100644
--- a/libsrc/MissingH/IO/HVFS/InstanceHelpers.hs
+++ b/libsrc/MissingH/IO/HVFS/InstanceHelpers.hs
@@ -47,6 +47,7 @@ module MissingH.IO.HVFS.InstanceHelpers(-- * HVFSStat objects
 where
 import MissingH.IO.HVFS
 import Data.IORef
+import Data.List
 import MissingH.Path
 import MissingH.Path.NameManip
 import Control.Monad.Error
@@ -57,11 +58,13 @@ import MissingH.IO.HVIO
 {- | A simple class that assumes that everything is either a file
 or a directory. -}
 data SimpleStat = SimpleStat {
-                              isFile :: Bool -- ^ True if file, False if directory
+                              isFile :: Bool, -- ^ True if file, False if directory
+                              fileSize :: FileOffset -- ^ Set to 0 if unknown or a directory
                              } deriving (Show, Eq)
 instance HVFSStat SimpleStat where
     vIsRegularFile x = isFile x
     vIsDirectory x = not (isFile x)
+    vFileSize x = fileSize x
 
 ----------------------------------------------------------------------
 -- In-Memory Tree Types
@@ -184,10 +187,12 @@ instance HVFS MemoryVFS where
     vGetFileStatus x fp = 
         do elem <- getMelem x fp
            case elem of
-                     (MemoryFile _) -> return $ HVFSStatEncap $
-                                             SimpleStat {isFile = True}
+                     (MemoryFile y) -> return $ HVFSStatEncap $
+                                             SimpleStat {isFile = True,
+                                                        fileSize = (genericLength y)}
                      (MemoryDirectory _) -> return $ HVFSStatEncap $
-                                             SimpleStat {isFile = False}
+                                             SimpleStat {isFile = False,
+                                                        fileSize = 0}
     vGetDirectoryContents x fp =
         do elem <- getMelem x fp
            case elem of

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list