feat: ftp plugin

This commit is contained in:
hstyi
2025-07-08 11:32:13 +08:00
committed by hstyi
parent ecf61bedc4
commit 165d544448
33 changed files with 826 additions and 88 deletions

View File

@@ -2,7 +2,7 @@ plugins {
alias(libs.plugins.kotlin.jvm)
}
project.version = "0.0.2"
project.version = "0.0.3"
dependencies {
testImplementation(kotlin("test"))

View File

@@ -1,12 +1,22 @@
package app.termora.plugins.smb
import app.termora.transfer.s3.S3FileSystem
import app.termora.transfer.s3.S3Path
import com.hierynomus.smbj.session.Session
import com.hierynomus.smbj.share.DiskShare
class SMBFileSystem(private val share: DiskShare, session: Session) :
S3FileSystem(SMBFileSystemProvider(share, session)) {
override fun create(root: String?, names: List<String>): S3Path {
val path = SMBPath(this, root, names)
if (names.isEmpty()) {
path.attributes = path.attributes.copy(directory = true)
}
return path
}
override fun close() {
share.close()
super.close()

View File

@@ -0,0 +1,20 @@
package app.termora.plugins.smb
import app.termora.transfer.s3.S3Path
class SMBPath(fileSystem: SMBFileSystem, root: String?, names: List<String>) : S3Path(fileSystem, root, names) {
override val isBucket: Boolean
get() = false
override val bucketName: String
get() = throw UnsupportedOperationException()
override val objectName: String
get() = throw UnsupportedOperationException()
override fun getCustomType(): String? {
return null
}
}