Rename CoreLocalPathVirtualFile -> CoreJrtVirtualFile

This commit is contained in:
Alexander Udalov
2017-08-21 18:20:24 +03:00
parent 46a1c8ca12
commit c142db15fa
2 changed files with 5 additions and 5 deletions
@@ -33,7 +33,7 @@ class CoreJrtFileSystem(private val fileSystem: FileSystem) : DeprecatedVirtualF
override fun getProtocol(): String = StandardFileSystems.JRT_PROTOCOL override fun getProtocol(): String = StandardFileSystems.JRT_PROTOCOL
private fun findFileByPath(path: Path): VirtualFile? = private fun findFileByPath(path: Path): VirtualFile? =
if (Files.exists(path)) CoreLocalPathVirtualFile(this, path) else null if (Files.exists(path)) CoreJrtVirtualFile(this, path) else null
override fun findFileByPath(path: String): VirtualFile? = override fun findFileByPath(path: String): VirtualFile? =
findFileByPath(fileSystem.getPath(path)) findFileByPath(fileSystem.getPath(path))
@@ -27,7 +27,7 @@ import java.nio.file.Files
import java.nio.file.Path import java.nio.file.Path
import java.nio.file.attribute.BasicFileAttributes import java.nio.file.attribute.BasicFileAttributes
class CoreLocalPathVirtualFile(private val fileSystem: VirtualFileSystem, private val path: Path) : VirtualFile() { internal class CoreJrtVirtualFile(private val fileSystem: VirtualFileSystem, private val path: Path) : VirtualFile() {
// TODO: catch IOException? // TODO: catch IOException?
private val attributes: BasicFileAttributes get() = Files.readAttributes(path, BasicFileAttributes::class.java) private val attributes: BasicFileAttributes get() = Files.readAttributes(path, BasicFileAttributes::class.java)
@@ -47,7 +47,7 @@ class CoreLocalPathVirtualFile(private val fileSystem: VirtualFileSystem, privat
override fun getParent(): VirtualFile? { override fun getParent(): VirtualFile? {
val parentPath = path.parent val parentPath = path.parent
return if (parentPath != null) CoreLocalPathVirtualFile(fileSystem, parentPath) else null return if (parentPath != null) CoreJrtVirtualFile(fileSystem, parentPath) else null
} }
override fun getChildren(): Array<out VirtualFile> { override fun getChildren(): Array<out VirtualFile> {
@@ -59,7 +59,7 @@ class CoreLocalPathVirtualFile(private val fileSystem: VirtualFileSystem, privat
} }
return when { return when {
paths.isEmpty() -> VirtualFile.EMPTY_ARRAY paths.isEmpty() -> VirtualFile.EMPTY_ARRAY
else -> paths.map { path -> CoreLocalPathVirtualFile(fileSystem, path) }.toTypedArray() else -> paths.map { path -> CoreJrtVirtualFile(fileSystem, path) }.toTypedArray()
} }
} }
@@ -82,7 +82,7 @@ class CoreLocalPathVirtualFile(private val fileSystem: VirtualFileSystem, privat
override fun getModificationStamp(): Long = 0 override fun getModificationStamp(): Long = 0
override fun equals(other: Any?): Boolean = override fun equals(other: Any?): Boolean =
other is CoreLocalPathVirtualFile && path == other.path && fileSystem == other.fileSystem other is CoreJrtVirtualFile && path == other.path && fileSystem == other.fileSystem
override fun hashCode(): Int = override fun hashCode(): Int =
path.hashCode() path.hashCode()