Fixed compilation of example-vfs project.
This commit is contained in:
@@ -26,7 +26,8 @@ fun main(args : Array<String>) {
|
|||||||
FileSystem.addVirtualFileListener{ event ->
|
FileSystem.addVirtualFileListener{ event ->
|
||||||
println(event)
|
println(event)
|
||||||
if (event is VirtualFileChangedEvent) {
|
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()}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,9 +50,12 @@ internal object RefreshQueue {
|
|||||||
/* Checks for changes in virtual file recursively, notifying listeners. */
|
/* Checks for changes in virtual file recursively, notifying listeners. */
|
||||||
private fun refreshFile(file : VirtualFile) {
|
private fun refreshFile(file : VirtualFile) {
|
||||||
FileSystem.assertCanWrite()
|
FileSystem.assertCanWrite()
|
||||||
|
val fileInfo = FileSystem.fileToInfo[file.path]
|
||||||
|
assert(fileInfo != null)
|
||||||
|
if (fileInfo == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
val fileToInfo = FileSystem.fileToInfo
|
|
||||||
val fileInfo = fileToInfo[file.path]
|
|
||||||
val oldChildren = fileInfo.children
|
val oldChildren = fileInfo.children
|
||||||
val newChildren = file.children()
|
val newChildren = file.children()
|
||||||
|
|
||||||
@@ -69,9 +72,6 @@ internal object RefreshQueue {
|
|||||||
|
|
||||||
commonChildren.foreach{ refreshFile(it) }
|
commonChildren.foreach{ refreshFile(it) }
|
||||||
} else {
|
} else {
|
||||||
val fileInfo = FileSystem.fileToInfo[file.path]
|
|
||||||
assert(fileInfo != null)
|
|
||||||
|
|
||||||
val newModificationTime = file.modificationTime()
|
val newModificationTime = file.modificationTime()
|
||||||
if (fileInfo.lastModified != newModificationTime) {
|
if (fileInfo.lastModified != newModificationTime) {
|
||||||
fileInfo.lastModified = newModificationTime
|
fileInfo.lastModified = newModificationTime
|
||||||
|
|||||||
Reference in New Issue
Block a user