Only change date of directory modification if it actually changed.

(cherry picked from commit c463df0)
This commit is contained in:
Vexatos 2018-02-16 00:48:56 +01:00 committed by payonel
parent 2256adf30c
commit db18c1df62

View File

@ -88,13 +88,14 @@ trait Buffered extends OutputStreamFileSystem {
} }
deletions.clear() deletions.clear()
def recurse(path: String) { def recurse(path: String):Boolean = {
val directory = new io.File(fileRoot, path) val directory = new io.File(fileRoot, path)
directory.mkdirs() directory.mkdirs()
var dirChanged = false
for (child <- list(path)) { for (child <- list(path)) {
val childPath = path + child val childPath = path + child
if (isDirectory(childPath)) if (isDirectory(childPath))
recurse(childPath) dirChanged = recurse(childPath) || dirChanged
else { else {
val childFile = new io.File(fileRoot, childPath) val childFile = new io.File(fileRoot, childPath)
val time = lastModified(childPath) val time = lastModified(childPath)
@ -107,10 +108,14 @@ trait Buffered extends OutputStreamFileSystem {
out.close() out.close()
in.close() in.close()
childFile.setLastModified(time) childFile.setLastModified(time)
dirChanged = true
} }
} }
} }
if (dirChanged) {
directory.setLastModified(lastModified(path)) directory.setLastModified(lastModified(path))
true
} else false
} }
if (list("") == null || list("").isEmpty) { if (list("") == null || list("").isEmpty) {
fileRoot.delete() fileRoot.delete()