diff --git a/src/main.d b/src/main.d index ebbae39fb..2bf126860 100644 --- a/src/main.d +++ b/src/main.d @@ -916,7 +916,9 @@ int main(string[] cliArgs) { filesystemMonitor.onDelete = delegate(string path) { if (verboseLogging) {addLogEntry("[M] Local item deleted: " ~ path, ["verbose"]);} try { - addLogEntry("The operating system sent a deletion notification. Trying to delete the item as requested"); + // The path has been deleted .. we cannot use isDir or isFile to advise what was deleted. This is the best we can Do + addLogEntry("The operating system sent a deletion notification. Trying to delete this item as requested: " ~ path); + // perform the delete action syncEngineInstance.deleteByPath(path); } catch (CurlException e) { if (verboseLogging) {addLogEntry("Offline, cannot delete item: " ~ path, ["verbose"]);} diff --git a/src/monitor.d b/src/monitor.d index 349562c7f..f5db7a741 100644 --- a/src/monitor.d +++ b/src/monitor.d @@ -610,6 +610,13 @@ final class Monitor { } else if (event.mask & IN_CREATE) { if (debugLogging) {addLogEntry("event IN_CREATE: " ~ path, ["debug"]);} if (event.mask & IN_ISDIR) { + // fix from #2586 + auto cookieToPath1 = cookieToPath.dup(); + foreach (cookie, path1; cookieToPath1) { + if (path1 == path) { + cookieToPath.remove(cookie); + } + } addRecursive(path); if (useCallbacks) actionHolder.append(ActionType.createDir, path); } @@ -622,6 +629,13 @@ final class Monitor { } } else if ((event.mask & IN_CLOSE_WRITE) && !(event.mask & IN_ISDIR)) { if (debugLogging) {addLogEntry("event IN_CLOSE_WRITE and not IN_ISDIR: " ~ path, ["debug"]);} + // fix from #2586 + auto cookieToPath1 = cookieToPath.dup(); + foreach (cookie, path1; cookieToPath1) { + if (path1 == path) { + cookieToPath.remove(cookie); + } + } if (useCallbacks) actionHolder.append(ActionType.changed, path); } else { addLogEntry("inotify event unhandled: " ~ path);