From a672db082f25814a9157c8e54aa2610d81fd545c Mon Sep 17 00:00:00 2001 From: Kirill Grachev Date: Fri, 28 Apr 2023 17:37:39 +0300 Subject: [PATCH] SNRK-57: Remove `File` from sources --- .../kotlin/space/kscience/snark/storage/s3/S3Root.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt index 3ab1a68..3f0037c 100644 --- a/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt +++ b/snark-storage-driver/src/main/kotlin/space/kscience/snark/storage/s3/S3Root.kt @@ -4,7 +4,6 @@ import aws.sdk.kotlin.services.s3.* import space.kscience.snark.storage.Directory import space.kscience.snark.storage.FileReader import space.kscience.snark.storage.FileWriter -import java.io.File import java.lang.Exception import java.nio.file.Path import kotlin.io.path.* @@ -23,15 +22,15 @@ internal fun splitPathIntoBucketAndPath(path: Path): Pair { internal class S3Root(private val client: S3Client) : Directory { override suspend fun get(filename: String): FileReader { - throw NoSuchFileException(File(filename)) + throw NoSuchFileException(Path(filename).toFile()) } override suspend fun create(filename: String, ignoreIfExists: Boolean) { - throw NoSuchFileException(File(filename)) + throw NoSuchFileException(Path(filename).toFile()) } override suspend fun put(filename: String): FileWriter { - throw NoSuchFileException(File(filename)) + throw NoSuchFileException(Path(filename).toFile()) } override suspend fun getSubdir(path: Path): Directory = try { @@ -51,7 +50,7 @@ internal class S3Root(private val client: S3Client) : Directory { } S3Directory(client, bucketName, filePath) } catch (ex: Exception) { - throw AccessDeniedException(File(dirname), reason = ex.message) + throw AccessDeniedException(Path(dirname).toFile(), reason = ex.message) } override fun close() {