IJOB-596: Do not purge .idea directory.

`training.project.ProjectUtils.protectedDirNames` is a set of dirs that should never be purged.

Due to mistype, it was `idea`, not `.idea`. As result, it was purged, `modules.xml` was dropped with an expected result.

GitOrigin-RevId: 2ee26f3b3e3ff7c65fb9fa9fd59760f9592bf8d4
This commit is contained in:
Ilya.Kazakevich
2025-05-28 19:11:06 +02:00
committed by intellij-monorepo-bot
parent f763800bc0
commit 0f93d4f37a
2 changed files with 7 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package training.project
import com.intellij.ide.GeneralSettings
@@ -33,23 +33,15 @@ import java.io.File
import java.io.FileFilter
import java.io.IOException
import java.io.PrintWriter
import java.nio.file.FileVisitResult
import java.nio.file.FileVisitor
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import java.nio.file.*
import java.nio.file.attribute.BasicFileAttributes
import java.util.concurrent.CompletableFuture
import kotlin.io.path.exists
import kotlin.io.path.getLastModifiedTime
import kotlin.io.path.isDirectory
import kotlin.io.path.name
import kotlin.io.path.pathString
import kotlin.io.path.*
object ProjectUtils {
private const val LEARNING_PROJECT_MODIFICATION = "LEARNING_PROJECT_MODIFICATION"
private const val FEATURE_TRAINER_VERSION = "feature-trainer-version.txt"
private val protectedDirNames = hashSetOf("idea", ".git", "git", "venv")
private val protectedDirNames = hashSetOf(Project.DIRECTORY_STORE_FOLDER, ".git", "git", "venv")
@ApiStatus.Internal

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package training.featuresSuggester
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ProjectManager
import com.intellij.testFramework.common.timeoutRunBlocking
import com.intellij.testFramework.junit5.TestApplication
@@ -41,9 +42,10 @@ class ProjectUtilsTest {
val goodFiles = arrayOf(
protectedFile,
root.resolve("venv").createDirectory(),
root.resolve(Project.DIRECTORY_STORE_FOLDER).resolve("modules.xml").createDirectories(),
root.resolve(".git").resolve("file").createParentDirectories().createFile())
LangManager.Companion.getInstance().setLearningProjectPath(lang, root.pathString)
LangManager.getInstance().setLearningProjectPath(lang, root.pathString)
ProjectUtils.restoreProject(lang, ProjectManager.getInstance().defaultProject)
Assertions.assertFalse(badFile.exists(), "$badFile should have been deleted")
for (goodFile in goodFiles) {