Permalink
Browse files

Only report *file* access time errors, not directories

  • Loading branch information...
1 parent 0ca39e8 commit 5fa199380d753c46d8b33fe1bece6e302ab88e73 @batterseapower committed Jan 31, 2011
Showing with 6 additions and 8 deletions.
  1. +6 −8 Development/Shake/Files.hs
View
@@ -41,8 +41,6 @@ import System.FilePath (takeDirectory, equalFilePath, makeRelative, (</>))
import System.FilePath.Glob
import System.Time (ClockTime(..))
-import Debug.Trace
-
type ModTime = ClockTime
@@ -124,21 +122,21 @@ instance Namespace CanonicalFilePath where
takeSnapshot = do
threadDelay (500 * 1000) -- Half a second delay to deal with access time resolution issues
cwd <- getCurrentDirectory >>= canonical
- fps <- explore cwd S.empty "."
+ (_, fps) <- explore cwd (S.empty, S.empty) "."
liftM (CFPSS . M.fromAscList) $ forM (S.toAscList fps) $ \fp -> liftM (fp,) (getAccessTime (canonicalFilePath fp))
where
- explore parent_fp seen fp = do
+ explore parent_fp (seen, seen_files) fp = do
fp <- canonical fp
if fp `S.member` seen || not (canonicalFilePath parent_fp `isPrefixOf` canonicalFilePath fp) -- Must prevent explore following ".." downwards to the root file system!
- then return seen
+ then return (seen, seen_files)
else do
let seen' = S.insert fp seen
is_file <- doesFileExist (canonicalFilePath fp)
if is_file
- then return seen'
- else getDirectoryContents (canonicalFilePath fp) >>= (foldM (explore fp) seen' . map (canonicalFilePath fp </>))
+ then return (seen', S.insert fp seen_files)
+ else getDirectoryContents (canonicalFilePath fp) >>= (foldM (explore fp) (seen', seen_files) . map (originalFilePath fp </>))
- compareSnapshots building_fps needed_fps (CFPSS ss) (CFPSS ss') = {- trace ("compareSnapshots " ++ show (ss, ss')) -} [show fp ++ " was accessed without 'need'ing it" | fp <- accessed_no_need]
+ compareSnapshots building_fps needed_fps (CFPSS ss) (CFPSS ss') = [show fp ++ " was accessed without 'need'ing it" | fp <- accessed_no_need]
where
(_ss_deleted, ss_continued, _ss_created) = zipMaps ss ss'
ss_accessed = M.filter (\(atime1, atime2) -> atime1 < atime2) ss_continued

0 comments on commit 5fa1993

Please sign in to comment.