mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2024-11-19 09:52:09 +01:00
Delete directory using Files.delete() (#5518)
This commit is contained in:
parent
b83661e73f
commit
3d29bef135
@ -6,7 +6,6 @@ import java.io.{FileOutputStream, IOException}
|
|||||||
import java.nio.file.attribute.BasicFileAttributes
|
import java.nio.file.attribute.BasicFileAttributes
|
||||||
import java.nio.file.{FileVisitResult, Files, Path, SimpleFileVisitor}
|
import java.nio.file.{FileVisitResult, Files, Path, SimpleFileVisitor}
|
||||||
import java.util.zip.{ZipEntry, ZipOutputStream}
|
import java.util.zip.{ZipEntry, ZipOutputStream}
|
||||||
import scala.reflect.io.Directory
|
|
||||||
import scala.util.matching.Regex
|
import scala.util.matching.Regex
|
||||||
|
|
||||||
object FileUtil extends BitcoinSLogger {
|
object FileUtil extends BitcoinSLogger {
|
||||||
@ -102,16 +101,14 @@ object FileUtil extends BitcoinSLogger {
|
|||||||
override def visitFile(
|
override def visitFile(
|
||||||
file: Path,
|
file: Path,
|
||||||
attrs: BasicFileAttributes): FileVisitResult = {
|
attrs: BasicFileAttributes): FileVisitResult = {
|
||||||
val directory = new Directory(file.toFile)
|
Files.delete(file)
|
||||||
directory.deleteRecursively()
|
|
||||||
FileVisitResult.CONTINUE
|
FileVisitResult.CONTINUE
|
||||||
}
|
}
|
||||||
|
|
||||||
override def postVisitDirectory(
|
override def postVisitDirectory(
|
||||||
dir: Path,
|
dir: Path,
|
||||||
exc: IOException): FileVisitResult = {
|
exc: IOException): FileVisitResult = {
|
||||||
val directory = new Directory(dir.toFile)
|
Files.delete(dir)
|
||||||
directory.deleteRecursively()
|
|
||||||
FileVisitResult.CONTINUE
|
FileVisitResult.CONTINUE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user