PY-77434, PY-76185: Allow spaces in project path.

We now allow spaces in project path (`validatePath`) but convert them to underlines for `projectName` (both changes are in `ProjectPathFlows`).

(cherry picked from commit cc875f7b4e6d2354fba79387a0fc9161a6d267e1)

GitOrigin-RevId: 620e5bca8a406c9588f3e4f54260e5e3162bf686
This commit is contained in:
Ilya.Kazakevich
2024-11-20 21:59:13 +01:00
committed by intellij-monorepo-bot
parent aaffc695ab
commit 4a8afad761

View File

@@ -35,7 +35,7 @@ class ProjectPathFlows private constructor(val projectPath: Flow<Path?>) {
/**
* Flow emits project file name only when project path is valid
*/
val projectName: Flow<@NlsSafe String> = projectPath.filterNotNull().map { it.name }
val projectName: Flow<@NlsSafe String> = projectPath.filterNotNull().map { it.name.replace(" ", "_") }
companion object {
@@ -71,7 +71,7 @@ class ProjectPathFlows private constructor(val projectPath: Flow<Path?>) {
return Result.Failure(PyBundle.message("python.sdk.new.error.no.absolute"))
}
for (validator in arrayOf(CHECK_NON_EMPTY, CHECK_NO_WHITESPACES, CHECK_NO_RESERVED_WORDS)) {
for (validator in arrayOf(CHECK_NON_EMPTY, CHECK_NO_RESERVED_WORDS)) {
validator.curry { pathAsString }.validate()?.let {
return Result.Failure(it.message)
}