Порядок файлов теперь сохраняется полностью
This commit is contained in:
parent
c04c89de0d
commit
6a39ed7f56
@ -16,7 +16,6 @@ import ru.dbotthepony.kstarbound.api.ISBFileLocator
|
|||||||
import ru.dbotthepony.kstarbound.api.IStarboundFile
|
import ru.dbotthepony.kstarbound.api.IStarboundFile
|
||||||
import ru.dbotthepony.kstarbound.api.NonExistingFile
|
import ru.dbotthepony.kstarbound.api.NonExistingFile
|
||||||
import ru.dbotthepony.kstarbound.api.PhysicalFile
|
import ru.dbotthepony.kstarbound.api.PhysicalFile
|
||||||
import ru.dbotthepony.kstarbound.api.explore
|
|
||||||
import ru.dbotthepony.kstarbound.defs.*
|
import ru.dbotthepony.kstarbound.defs.*
|
||||||
import ru.dbotthepony.kstarbound.defs.image.AtlasConfiguration
|
import ru.dbotthepony.kstarbound.defs.image.AtlasConfiguration
|
||||||
import ru.dbotthepony.kstarbound.defs.image.ImageReference
|
import ru.dbotthepony.kstarbound.defs.image.ImageReference
|
||||||
|
@ -61,6 +61,11 @@ interface IStarboundFile : ISBFileLocator {
|
|||||||
return children?.get(name)
|
return children?.get(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun explore(): Stream<IStarboundFile> {
|
||||||
|
val children = children ?: return Stream.of(this)
|
||||||
|
return Stream.concat(Stream.of(this), children.values.stream().flatMap { it.explore() })
|
||||||
|
}
|
||||||
|
|
||||||
fun computeFullPath(): String {
|
fun computeFullPath(): String {
|
||||||
var path = name
|
var path = name
|
||||||
var parent = parent
|
var parent = parent
|
||||||
@ -224,11 +229,6 @@ class NonExistingFile(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IStarboundFile.explore(): Stream<IStarboundFile> {
|
|
||||||
val children = children ?: return Stream.of(this)
|
|
||||||
return Stream.concat(Stream.of(this), children.values.stream().flatMap { it.explore() })
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getPathFolder(path: String): String {
|
fun getPathFolder(path: String): String {
|
||||||
return path.substringBeforeLast('/')
|
return path.substringBeforeLast('/')
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.kstarbound.io
|
package ru.dbotthepony.kstarbound.io
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectFunction
|
import it.unimi.dsi.fastutil.objects.Object2ObjectFunction
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap
|
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap
|
||||||
import ru.dbotthepony.kstarbound.api.IStarboundFile
|
import ru.dbotthepony.kstarbound.api.IStarboundFile
|
||||||
import ru.dbotthepony.kstarbound.io.json.BinaryJsonReader
|
import ru.dbotthepony.kstarbound.io.json.BinaryJsonReader
|
||||||
@ -35,7 +36,7 @@ class StarboundPak(val path: File, callback: (finished: Boolean, status: String)
|
|||||||
get() = false
|
get() = false
|
||||||
|
|
||||||
private var frozen = false
|
private var frozen = false
|
||||||
private val innerChildren = Object2ObjectOpenHashMap<String, IStarboundFile>()
|
private val innerChildren = Object2ObjectLinkedOpenHashMap<String, IStarboundFile>()
|
||||||
|
|
||||||
fun put(value: IStarboundFile) {
|
fun put(value: IStarboundFile) {
|
||||||
check(!frozen) { "Can't put, already frozen!" }
|
check(!frozen) { "Can't put, already frozen!" }
|
||||||
|
Loading…
Reference in New Issue
Block a user