KT-57870: Suppress InvalidPathException for paths with invalid characters when loading Konan library
^KT-57870 Fixed
This commit is contained in:
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.konan.util.KonanHomeProvider
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
|
import java.nio.file.InvalidPathException
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
|
|
||||||
private fun decodeFromUtf8(bytes: ByteArray) = String(bytes)
|
private fun decodeFromUtf8(bytes: ByteArray) = String(bytes)
|
||||||
@@ -114,7 +115,11 @@ private val systemTmpDir = System.getProperty("java.io.tmpdir")
|
|||||||
|
|
||||||
// TODO: File(..).deleteOnExit() does not work on Windows. May be use FILE_FLAG_DELETE_ON_CLOSE?
|
// TODO: File(..).deleteOnExit() does not work on Windows. May be use FILE_FLAG_DELETE_ON_CLOSE?
|
||||||
private fun tryLoadKonanLibrary(dir: String, fullLibraryName: String, runFromDaemon: Boolean): Boolean {
|
private fun tryLoadKonanLibrary(dir: String, fullLibraryName: String, runFromDaemon: Boolean): Boolean {
|
||||||
val fullLibraryPath = Paths.get(dir, fullLibraryName)
|
val fullLibraryPath = try {
|
||||||
|
Paths.get(dir, fullLibraryName)
|
||||||
|
} catch (ignored: InvalidPathException) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if (!Files.exists(fullLibraryPath)) return false
|
if (!Files.exists(fullLibraryPath)) return false
|
||||||
|
|
||||||
fun createTempDirWithLibrary() = if (runFromDaemon) {
|
fun createTempDirWithLibrary() = if (runFromDaemon) {
|
||||||
|
|||||||
Reference in New Issue
Block a user