mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[terminal] fix warnings in TerminalProjectOptionsProvider.kt
Migrate to `java.nio` and specify types explicitly GitOrigin-RevId: 9c8bbf7aa9a6bf4759cb159d27dd769988891ebc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2da2caf3db
commit
e9ff7f2a45
+8
-8
@@ -20,7 +20,7 @@ import com.intellij.platform.eel.provider.toEelApiBlocking
|
||||
import com.intellij.platform.eel.provider.utils.fetchLoginShellEnvVariablesBlocking
|
||||
import com.intellij.util.xmlb.annotations.Property
|
||||
import org.jetbrains.plugins.terminal.settings.TerminalLocalOptions
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
import kotlin.reflect.KMutableProperty0
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
@@ -52,7 +52,7 @@ class TerminalProjectOptionsProvider(val project: Project) : PersistentStateComp
|
||||
var startingDirectory: String? = null
|
||||
var shellPath: String? = null
|
||||
@get:Property(surroundWithTag = false, flat = true)
|
||||
var envDataOptions = EnvironmentVariablesDataOptions()
|
||||
var envDataOptions: EnvironmentVariablesDataOptions = EnvironmentVariablesDataOptions()
|
||||
}
|
||||
|
||||
var startingDirectory: String? by ValueWithDefault(state::startingDirectory) { defaultStartingDirectory }
|
||||
@@ -128,14 +128,14 @@ class TerminalProjectOptionsProvider(val project: Project) : PersistentStateComp
|
||||
return "wsl.exe --distribution $wslDistributionName"
|
||||
}
|
||||
}
|
||||
val shell = System.getenv("SHELL")
|
||||
if (shell != null && File(shell).canExecute()) {
|
||||
return shell
|
||||
val shell = System.getenv("SHELL")?.let { NioFiles.toPath(it) }
|
||||
if (shell != null && Files.exists(shell)) {
|
||||
return shell.toString()
|
||||
}
|
||||
if (SystemInfo.isUnix) {
|
||||
val bashPath = "/bin/bash"
|
||||
if (File(bashPath).exists()) {
|
||||
return bashPath
|
||||
val bashPath = NioFiles.toPath("/bin/bash")
|
||||
if (bashPath != null && Files.exists(bashPath)) {
|
||||
return bashPath.toString()
|
||||
}
|
||||
return "/bin/sh"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user