mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-13 01:10:19 -04:00
Made the thing Java 1.6 compatible again (at least it works on openjdk6). Should close #565 for good.
This commit is contained in:
parent
8511c836fa
commit
5e4758079f
Binary file not shown.
Binary file not shown.
@ -182,7 +182,7 @@ object SaveHandler {
|
||||
// Touch all externally saved data when loading, to avoid it getting
|
||||
// deleted in the next save (because the now - save time will usually
|
||||
// be larger than the time out after loading a world again).
|
||||
if (SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_7)) visitJava17()
|
||||
if (SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_7)) SaveHandlerJava17Functionality.visitJava17(statePath)
|
||||
else visitJava16()
|
||||
}
|
||||
|
||||
@ -196,21 +196,6 @@ object SaveHandler {
|
||||
recurse(statePath)
|
||||
}
|
||||
|
||||
private def visitJava17() {
|
||||
Files.walkFileTree(statePath.toPath, new FileVisitor[Path] {
|
||||
override def visitFile(file: Path, attrs: BasicFileAttributes) = {
|
||||
file.toFile.setLastModified(System.currentTimeMillis())
|
||||
FileVisitResult.CONTINUE
|
||||
}
|
||||
|
||||
override def visitFileFailed(file: Path, exc: IOException) = FileVisitResult.CONTINUE
|
||||
|
||||
override def preVisitDirectory(dir: Path, attrs: BasicFileAttributes) = FileVisitResult.CONTINUE
|
||||
|
||||
override def postVisitDirectory(dir: Path, exc: IOException) = FileVisitResult.CONTINUE
|
||||
})
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
def onWorldSave(e: WorldEvent.Save) {
|
||||
saveData.synchronized {
|
||||
@ -237,3 +222,20 @@ object SaveHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object SaveHandlerJava17Functionality {
|
||||
def visitJava17(statePath: File) {
|
||||
Files.walkFileTree(statePath.toPath, new FileVisitor[Path] {
|
||||
override def visitFile(file: Path, attrs: BasicFileAttributes) = {
|
||||
file.toFile.setLastModified(System.currentTimeMillis())
|
||||
FileVisitResult.CONTINUE
|
||||
}
|
||||
|
||||
override def visitFileFailed(file: Path, exc: IOException) = FileVisitResult.CONTINUE
|
||||
|
||||
override def preVisitDirectory(dir: Path, attrs: BasicFileAttributes) = FileVisitResult.CONTINUE
|
||||
|
||||
override def postVisitDirectory(dir: Path, exc: IOException) = FileVisitResult.CONTINUE
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user