mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-26565 Don't append a number to already existing environment directory name
It's better to leave the decision about the resulting name to the user by warning them about this problem.
This commit is contained in:
@@ -137,9 +137,9 @@ class PyAddNewCondaEnvPanel(private val project: Project?,
|
||||
}
|
||||
|
||||
private fun updatePathField() {
|
||||
val baseDir = defaultBaseDir ?: SystemProperties.getUserHome() + "/.conda/envs"
|
||||
val baseDir = defaultBaseDir ?: "${SystemProperties.getUserHome()}/.conda/envs"
|
||||
val dirName = PathUtil.getFileName(projectBasePath ?: "untitled")
|
||||
pathField.text = FileUtil.toSystemDependentName(FileUtil.findSequentNonexistentFile(File(baseDir), dirName, "").path)
|
||||
pathField.text = FileUtil.toSystemDependentName("$baseDir/$dirName")
|
||||
}
|
||||
|
||||
private fun validateAnacondaPath(): ValidationInfo? {
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.intellij.openapi.vfs.StandardFileSystems
|
||||
import com.intellij.openapi.vfs.VfsUtil
|
||||
import com.intellij.ui.DocumentAdapter
|
||||
import com.intellij.ui.components.JBCheckBox
|
||||
import com.intellij.util.PathUtil
|
||||
import com.intellij.util.SystemProperties
|
||||
import com.intellij.util.ui.FormBuilder
|
||||
import com.jetbrains.python.packaging.PyPackageManager
|
||||
@@ -39,7 +38,6 @@ import com.jetbrains.python.sdk.*
|
||||
import icons.PythonIcons
|
||||
import org.jetbrains.annotations.SystemIndependent
|
||||
import java.awt.BorderLayout
|
||||
import java.io.File
|
||||
import javax.swing.Icon
|
||||
import javax.swing.event.DocumentEvent
|
||||
|
||||
@@ -74,10 +72,7 @@ class PyAddNewVirtualEnvPanel(private val project: Project?,
|
||||
}
|
||||
}
|
||||
private val pathField = TextFieldWithBrowseButton().apply {
|
||||
val defaultBasePath = FileUtil.toSystemDependentName(PySdkSettings.instance.getPreferredVirtualEnvBasePath(projectBasePath))
|
||||
val parentPath = PathUtil.getParentPath(defaultBasePath)
|
||||
val fileName = PathUtil.getFileName(defaultBasePath)
|
||||
text = FileUtil.findSequentNonexistentFile(File(parentPath), fileName, "").path
|
||||
text = FileUtil.toSystemDependentName(PySdkSettings.instance.getPreferredVirtualEnvBasePath(projectBasePath))
|
||||
addBrowseFolderListener("Select Location for Virtual Environment", null, project,
|
||||
FileChooserDescriptorFactory.createSingleFolderDescriptor())
|
||||
}
|
||||
@@ -96,9 +91,8 @@ class PyAddNewVirtualEnvPanel(private val project: Project?,
|
||||
}
|
||||
|
||||
override fun validateAll() =
|
||||
listOf(validateEmptyOrNonExistingDirectoryLocation(pathField),
|
||||
validateSdkComboBox(baseSdkField))
|
||||
.filterNotNull()
|
||||
listOfNotNull(validateEmptyOrNonExistingDirectoryLocation(pathField),
|
||||
validateSdkComboBox(baseSdkField))
|
||||
|
||||
override fun getOrCreateSdk(): Sdk? {
|
||||
val root = pathField.text
|
||||
|
||||
Reference in New Issue
Block a user