Fixed compilation of example-vfs project.

This commit is contained in:
Evgeny Gerashchenko
2012-02-27 16:53:58 +04:00
parent 963557f3c8
commit 12f7d463ad
2 changed files with 7 additions and 6 deletions
+2 -1
View File
@@ -26,7 +26,8 @@ fun main(args : Array<String>) {
FileSystem.addVirtualFileListener{ event ->
println(event)
if (event is VirtualFileChangedEvent) {
println("new file size is ${event.file.size()}")
// FIXME explicit type casting to avoid overload ambiguity (KT-1461)
println("new file size is ${(event as VirtualFileChangedEvent).file.size()}")
}
}
+5 -5
View File
@@ -50,9 +50,12 @@ internal object RefreshQueue {
/* Checks for changes in virtual file recursively, notifying listeners. */
private fun refreshFile(file : VirtualFile) {
FileSystem.assertCanWrite()
val fileInfo = FileSystem.fileToInfo[file.path]
assert(fileInfo != null)
if (fileInfo == null) {
return
}
if (file.isDirectory()) {
val fileToInfo = FileSystem.fileToInfo
val fileInfo = fileToInfo[file.path]
val oldChildren = fileInfo.children
val newChildren = file.children()
@@ -69,9 +72,6 @@ internal object RefreshQueue {
commonChildren.foreach{ refreshFile(it) }
} else {
val fileInfo = FileSystem.fileToInfo[file.path]
assert(fileInfo != null)
val newModificationTime = file.modificationTime()
if (fileInfo.lastModified != newModificationTime) {
fileInfo.lastModified = newModificationTime