Skip to content

Commit f147ca9

Browse files
committed
refactor(embedding): restore and implement toNioPathOrNull extension function
1 parent 7de0aff commit f147ca9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/kotlin/cc/unitmesh/devti/embedding/SemanticService.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import com.intellij.openapi.project.Project
1212
import com.intellij.openapi.project.guessProjectDir
1313
import com.intellij.openapi.util.io.FileUtilRt
1414
import com.intellij.openapi.vfs.VirtualFile
15-
import com.intellij.openapi.vfs.toNioPathOrNull
1615
import kotlinx.coroutines.*
1716
import java.io.File
1817
import java.nio.file.Path
@@ -128,4 +127,8 @@ fun VirtualFile.canBeAdded(): Boolean {
128127
if (this.fileType.isBinary || FileUtilRt.isTooLarge(this.length)) return false
129128

130129
return true
131-
}
130+
}
131+
132+
fun VirtualFile.toNioPathOrNull(): Path? {
133+
return runCatching { toNioPath() }.getOrNull()
134+
}

0 commit comments

Comments
 (0)