com.avito.utils.Path.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of files Show documentation
Show all versions of files Show documentation
Collection of infrastructure libraries and gradle plugins of Avito Android project
package com.avito.utils
import androidx.annotation.RequiresApi
import com.avito.android.Result
import java.nio.file.Path
@RequiresApi(api = 26)
public fun Path.deleteRecursively(): Result {
return Result.tryCatch {
val isDeleted = toFile().deleteRecursively()
if (!isDeleted) {
throw IllegalStateException("not cleared, reason unknown because of java.io.File API")
}
}
}