Gitnuro/src/main/kotlin/app/TempFilesManager.kt
2022-02-04 01:34:22 +01:00

20 lines
422 B
Kotlin

package app
import app.di.TabScope
import javax.inject.Inject
import kotlin.io.path.createTempDirectory
import kotlin.io.path.deleteIfExists
@TabScope
class TempFilesManager @Inject constructor() {
val tempDir by lazy {
val tempDirPath = createTempDirectory("gitnuro_")
tempDirPath.toFile().deleteOnExit()
tempDirPath
}
fun removeTempDir() {
tempDir.deleteIfExists()
}
}