diff --git a/plugins/ide-features-trainer/src/training/project/ProjectUtils.kt b/plugins/ide-features-trainer/src/training/project/ProjectUtils.kt index 397b75e32b59..c8f62ac61d05 100644 --- a/plugins/ide-features-trainer/src/training/project/ProjectUtils.kt +++ b/plugins/ide-features-trainer/src/training/project/ProjectUtils.kt @@ -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 diff --git a/plugins/ide-features-trainer/testSrc/training/featuresSuggester/ProjectUtilsTest.kt b/plugins/ide-features-trainer/testSrc/training/featuresSuggester/ProjectUtilsTest.kt index 917de54fbe97..cfd2d9a6d7e6 100644 --- a/plugins/ide-features-trainer/testSrc/training/featuresSuggester/ProjectUtilsTest.kt +++ b/plugins/ide-features-trainer/testSrc/training/featuresSuggester/ProjectUtilsTest.kt @@ -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) {