AA: make paths platform-independent before using JRT file system

^KT-59697 Fixed
This commit is contained in:
Jinseong Jeon
2023-06-27 11:44:28 -07:00
committed by Ilya Kirillov
parent bf1c9774aa
commit 0d19a5b3ea
4 changed files with 12 additions and 7 deletions
@@ -17,6 +17,7 @@ import com.intellij.openapi.Disposable
import com.intellij.openapi.extensions.PluginDescriptor
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.PackageIndex
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.psi.*
@@ -318,7 +319,7 @@ object StandaloneProjectFactory {
environment: KotlinCoreProjectEnvironment,
): List<VirtualFile> {
return roots.mapNotNull { path ->
val pathString = path.toAbsolutePath().toString()
val pathString = FileUtil.toSystemIndependentName(path.toAbsolutePath().toString())
when {
pathString.endsWith(JAR_PROTOCOL) -> {
environment.environment.jarFileSystem.findFileByPath(pathString + JAR_SEPARATOR)
@@ -366,7 +367,9 @@ object StandaloneProjectFactory {
private fun KtBinaryModule.getJavaRoots(
environment: KotlinCoreProjectEnvironment,
): List<JavaRoot> {
return getVirtualFilesForLibraryRoots(getBinaryRoots(), environment).map { root -> JavaRoot(root, JavaRoot.RootType.BINARY)}
return getVirtualFilesForLibraryRoots(getBinaryRoots(), environment).map { root ->
JavaRoot(root, JavaRoot.RootType.BINARY)
}
}
private fun adjustModulePath(pathString: String): String {