workaround other part of moved directory problem
This fixes the scenario where: * directory foo is moved away (and still watched) * a new directory foo is made * file (or directory) foo/bar is created * the old directory's file (or directory) "bar" is deleted We don't want a deletion event for foo/bar in this case.
This commit is contained in:
parent
fa9d479fd1
commit
47f8f43715
1 changed files with 11 additions and 2 deletions
|
@ -98,16 +98,25 @@ watchDir i dir ignored add addsymlink del deldir
|
|||
go (MovedIn { filePath = f }) = walk f
|
||||
go (MovedOut { isDirectory = True, filePath = d }) = deldir <@> d
|
||||
go (MovedOut { filePath = f }) = del <@> f
|
||||
go (Deleted { isDirectory = True, filePath = d }) = deldir <@> d
|
||||
go (Deleted { filePath = f }) = del <@> f
|
||||
go (Deleted { isDirectory = True, filePath = d }) =
|
||||
notexist d $ deldir <@> d
|
||||
go (Deleted { filePath = f }) =
|
||||
notexist f $ del <@> f
|
||||
go _ = noop
|
||||
|
||||
Just a <@> f = a $ indir f
|
||||
Nothing <@> _ = noop
|
||||
|
||||
indir f = dir </> f
|
||||
|
||||
filetype t f = catchBoolIO $ t <$> getSymbolicLinkStatus (indir f)
|
||||
|
||||
-- Check that a file or directory does not exist.
|
||||
-- This is used when there could be a spurious deletion
|
||||
-- event for an item in a directory that has been moved away
|
||||
-- but is still being watched.
|
||||
notexist f = unlessM (filetype (const True) f)
|
||||
|
||||
{- Pauses the main thread, letting children run until program termination. -}
|
||||
waitForTermination :: IO ()
|
||||
waitForTermination = do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue