Skip to content

Commit e212b7e

Browse files
ilmirusSpace Cloud
authored and
Space Cloud
committed
FIR: Do not follow non-existing symbolic links
Otherwise, `toRealPath` fails with FileNotFoundException #KT-77445 Fixed
1 parent 973be25 commit e212b7e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/DependencyListForCliModule.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import org.jetbrains.kotlin.fir.deserialization.MultipleModuleDataProvider
1111
import org.jetbrains.kotlin.name.Name
1212
import java.nio.file.Path
1313
import java.nio.file.Paths
14+
import kotlin.io.path.exists
15+
import kotlin.io.path.isSymbolicLink
1416

1517
/**
1618
* This class represents the set of dependencies for some source module.
@@ -107,7 +109,9 @@ class DependencyListForCliModule @PrivateSessionConstructor constructor(
107109
if (paths.isEmpty()) return
108110
val filterSet = filtersMap.getOrPut(moduleData) { mutableSetOf() }
109111
paths.mapTo(filterSet) {
110-
Paths.get(it).toRealPath()
112+
val path = Paths.get(it)
113+
if (path.isSymbolicLink()) path.toRealPath()
114+
else path.toAbsolutePath()
111115
}
112116
}
113117

0 commit comments

Comments
 (0)