summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-06-26 12:30:37 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-06-26 12:30:37 -0400
commited26834c8061738d7613222177e29201e17a4066 (patch)
tree7618778ee5595b9dbaaf51d3c4d4254015e9d5ea /Utility
parentb0e577f63bda992a0f3d05323298d5e2d1f923de (diff)
assistant: Fix bug that prevented adding files written by gnucash, and more generally support adding hard links to files. However, other operations on hard links are still unsupported.
Diffstat (limited to 'Utility')
-rw-r--r--Utility/INotify.hs20
1 files changed, 13 insertions, 7 deletions
diff --git a/Utility/INotify.hs b/Utility/INotify.hs
index 7b5a1fbea..2ce2b36aa 100644
--- a/Utility/INotify.hs
+++ b/Utility/INotify.hs
@@ -90,15 +90,21 @@ watchDir i dir ignored hooks
| otherwise ->
noop
- -- Ignore creation events for regular files, which won't be
- -- done being written when initially created, but handle for
- -- directories and symlinks.
go (Created { isDirectory = isd, filePath = f })
| isd = recurse $ indir f
- | hashook addSymlinkHook =
- checkfiletype Files.isSymbolicLink addSymlinkHook f
- | otherwise = noop
- -- Closing a file is assumed to mean it's done being written.
+ | otherwise = do
+ ms <- getstatus f
+ case ms of
+ Just s
+ | Files.isSymbolicLink s ->
+ when (hashook addSymlinkHook) $
+ runhook addSymlinkHook f ms
+ | Files.isRegularFile s ->
+ when (hashook addHook) $
+ runhook addHook f ms
+ _ -> noop
+ -- Closing a file is assumed to mean it's done being written,
+ -- so a new add event is sent.
go (Closed { isDirectory = False, maybeFilePath = Just f }) =
checkfiletype Files.isRegularFile addHook f
-- When a file or directory is moved in, scan it to add new