mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
[eel] IJPL-165252: Use NIO to detect non-empty directories in NPW
(cherry picked from commit f2f7c243e6bf58fd2cd05fb8230ff3c261f0d1d3) IJ-CR-148300 GitOrigin-RevId: ce6d1caf48f997316a5b8d4ba335227ed749fbba
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4a5ddd21ce
commit
c0b7d8f94c
@@ -7,8 +7,10 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.project.rootManager
|
||||
import com.intellij.ui.UIBundle
|
||||
import java.io.IOException
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.InvalidPathException
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
|
||||
val CHECK_NON_EMPTY: DialogValidation.WithParameter<() -> String> = validationErrorIf<String>(UIBundle.message("kotlin.dsl.validation.missing.value")) { it.isEmpty() }
|
||||
|
||||
@@ -28,8 +30,9 @@ val CHECK_NAME_FORMAT: DialogValidation.WithParameter<() -> String> = validation
|
||||
}
|
||||
|
||||
val CHECK_NON_EMPTY_DIRECTORY: DialogValidation.WithParameter<() -> String> = validationFileErrorFor { file ->
|
||||
val children by lazy { file.list() }
|
||||
if (file.exists() && children != null && children.isNotEmpty()) {
|
||||
val path = file.toPath()
|
||||
val children by lazy { Files.list(path).toList() }
|
||||
if (Files.exists(path) && children != null && children.isNotEmpty()) {
|
||||
UIBundle.message("label.project.wizard.new.project.directory.not.empty.warning", file.name)
|
||||
}
|
||||
else null
|
||||
|
||||
Reference in New Issue
Block a user