DroidFS/app/src/main/java/sushi/hardcore/droidfs/file_operations/OperationFile.kt

22 lines
696 B
Kotlin
Raw Normal View History

2020-12-29 17:05:02 +01:00
package sushi.hardcore.droidfs.file_operations
import sushi.hardcore.droidfs.explorers.ExplorerElement
2022-06-18 21:13:16 +02:00
import sushi.hardcore.droidfs.filesystems.Stat
import sushi.hardcore.droidfs.util.PathUtils
import java.io.File
class OperationFile(val srcPath: String, val type: Int, var dstPath: String? = null, var overwriteConfirmed: Boolean = false) {
val isDirectory = type == Stat.S_IFDIR
val name: String by lazy {
File(srcPath).name
}
val parentPath by lazy {
PathUtils.getParentPath(srcPath)
}
2020-12-29 17:05:02 +01:00
companion object {
fun fromExplorerElement(e: ExplorerElement): OperationFile {
2022-06-18 21:13:16 +02:00
return OperationFile(e.fullPath, e.stat.type)
2020-12-29 17:05:02 +01:00
}
}
}