diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2024-10-14 21:41:06 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2024-10-14 22:45:57 +0200 |
| commit | ea9621389bfa62cb4e63688249c52ac0e41ff282 (patch) | |
| tree | 4932900d0c058aa7e187fc02b214a024f801db18 /libs/samba/src/main/java | |
| parent | 2be5a5171de2ecd51973862c243aecc0be4a0876 (diff) | |
Add tests for create dir/file/link that already exists
Fix implementations to work as expected
(that createDirectory/File/Link fails if an entry with that name
already exists).
Diffstat (limited to 'libs/samba/src/main/java')
| -rw-r--r-- | libs/samba/src/main/java/org/the_jk/cleversync/io/samba/SambaDirectory.kt | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libs/samba/src/main/java/org/the_jk/cleversync/io/samba/SambaDirectory.kt b/libs/samba/src/main/java/org/the_jk/cleversync/io/samba/SambaDirectory.kt index 4865d7f..7ca4732 100644 --- a/libs/samba/src/main/java/org/the_jk/cleversync/io/samba/SambaDirectory.kt +++ b/libs/samba/src/main/java/org/the_jk/cleversync/io/samba/SambaDirectory.kt @@ -12,6 +12,7 @@ import org.the_jk.cleversync.io.ModifiableDirectory import org.the_jk.cleversync.io.ModifiableFile import org.the_jk.cleversync.io.ModifiableLink import java.io.IOException +import java.nio.file.FileAlreadyExistsException import java.time.Instant import kotlin.time.Duration.Companion.seconds @@ -105,6 +106,7 @@ internal open class SambaDirectory( override fun createFile(name: String): ModifiableFile { val newPath = PathUtils.join(path, name) + if (conn.entry(newPath) != null) throw FileAlreadyExistsException(name) return SambaFile(conn, newPath, name, 0UL, Instant.EPOCH, Instant.EPOCH) } |
