File tree Expand file tree Collapse file tree 4 files changed +14
-9
lines changed
utbot-core/src/main/kotlin/org/utbot/common
utbot-framework/src/main/kotlin/org/utbot/engine/z3
kotlin/org/utbot/intellij/plugin/settings Expand file tree Collapse file tree 4 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -75,20 +75,16 @@ object FileUtil {
7575 }.forEach { it.deleteRecursively() }
7676 }
7777
78- private fun createTempDirectory (): Path {
79- val tempFolderPath = Paths .get(tempDirectoryPath + File .separator + utBotTempFolderPrefix)
80-
81- tempFolderPath.toFile().mkdirs()
82-
83- return createTempDirectory(tempFolderPath, " generated-" )
78+ fun createTempDirectory (prefix : String ): Path {
79+ return createTempDirectory(utBotTempDirectory, prefix)
8480 }
8581
8682 /* *
8783 * Copy the class file for given [classes] to temporary folder.
8884 * It can be used for Soot analysis.
8985 */
9086 fun isolateClassFiles (vararg classes : KClass <* >): File {
91- val tempDir = createTempDirectory().toFile()
87+ val tempDir = createTempDirectory(" generated- " ).toFile()
9288
9389 for (clazz in classes) {
9490 val path = clazz.toClassFilePath()
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package org.utbot.engine.z3
22
33import com.microsoft.z3.Context
44import com.microsoft.z3.Global
5+ import org.utbot.common.FileUtil
56import java.io.File
67import java.nio.file.Files.createTempDirectory
78
@@ -41,7 +42,7 @@ abstract class Z3Initializer : AutoCloseable {
4142
4243 val libFolder: String?
4344 if (libZ3DllUrl.toURI().scheme == " jar" ) {
44- val tempDir = createTempDirectory(null ).toFile(). apply { deleteOnExit() }
45+ val tempDir = FileUtil . createTempDirectory(" libs- " ).toFile()
4546
4647 allLibraries.forEach { name ->
4748 Z3Initializer ::class .java
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ import com.intellij.openapi.components.Storage
3232import com.intellij.openapi.project.Project
3333import com.intellij.util.xmlb.Converter
3434import com.intellij.util.xmlb.annotations.OptionTag
35+ import org.utbot.common.FileUtil
36+ import java.util.concurrent.CompletableFuture
3537import kotlin.reflect.KClass
3638
3739@State(
@@ -153,6 +155,11 @@ class Settings(val project: Project) : PersistentStateComponent<Settings.State>
153155
154156 override fun getState (): State = state
155157
158+ override fun initializeComponent () {
159+ super .initializeComponent()
160+ CompletableFuture .runAsync { FileUtil .clearTempDirectory(UtSettings .daysLimitForTempFiles) }
161+ }
162+
156163 override fun loadState (state : State ) {
157164 this .state = state
158165 }
Original file line number Diff line number Diff line change 3030 <projectConfigurable parentId =" tools" instance =" org.utbot.intellij.plugin.settings.Configurable"
3131 id =" org.utbot.intellij.plugin.settings.Configurable"
3232 displayName =" UtBot" />
33- <projectService serviceImplementation =" org.utbot.intellij.plugin.settings.Settings" />
33+ <!-- suppress PluginXmlValidity -->
34+ <projectService serviceImplementation =" org.utbot.intellij.plugin.settings.Settings" preload =" true" />
3435 <registryKey defaultValue =" false" description =" Enable editing Kotlin test files" key =" kotlin.ultra.light.classes.empty.text.range" />
3536 </extensions >
3637
You can’t perform that action at this time.
0 commit comments