mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ExternalStorage — remove all storage files
This commit is contained in:
+1
@@ -121,6 +121,7 @@ private fun createStorage(project: Project): PersistentHashMap<String, ByteArray
|
||||
})
|
||||
|
||||
fun deleteFileAndWriteLatestFormatVersion() {
|
||||
dir.deleteChildrenStartingWith(file.fileName.toString())
|
||||
file.delete()
|
||||
versionFile.outputStream().use { it.write(MODULE_FILE_FORMAT_VERSION) }
|
||||
|
||||
|
||||
@@ -98,6 +98,12 @@ fun Path.deleteWithParentsIfEmpty(root: Path, isFile: Boolean = true): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
fun Path.deleteChildrenStartingWith(prefix: String) {
|
||||
directoryStreamIfExists({ it.fileName.toString().startsWith(prefix) }) { it.toList() }?.forEach {
|
||||
it.delete()
|
||||
}
|
||||
}
|
||||
|
||||
private fun Path.deleteRecursively() = Files.walkFileTree(this, object : SimpleFileVisitor<Path>() {
|
||||
override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user