diff --git a/common/src/commonMain/kotlin/net/dankito/utils/multiplatform/File.kt b/common/src/commonMain/kotlin/net/dankito/utils/multiplatform/File.kt index 2ccb74f6..1163974c 100644 --- a/common/src/commonMain/kotlin/net/dankito/utils/multiplatform/File.kt +++ b/common/src/commonMain/kotlin/net/dankito/utils/multiplatform/File.kt @@ -18,4 +18,6 @@ expect class File(path: String) { fun mkdirs(): Boolean + fun delete(): Boolean + } \ No newline at end of file diff --git a/common/src/iosMain/kotlin/net/dankito/utils/multiplatform/File.kt b/common/src/iosMain/kotlin/net/dankito/utils/multiplatform/File.kt index 155c8219..418962ce 100644 --- a/common/src/iosMain/kotlin/net/dankito/utils/multiplatform/File.kt +++ b/common/src/iosMain/kotlin/net/dankito/utils/multiplatform/File.kt @@ -27,6 +27,10 @@ actual class File actual constructor(path: String) : NSURL(fileURLWithPath = pat return NSFileManager.defaultManager.createDirectoryAtURL(this, true, null, null) } + actual fun delete(): Boolean { + return NSFileManager.defaultManager.removeItemAtURL(this, null) + } + override fun description(): String? { return getAbsolutePath() diff --git a/common/src/jvmMain/kotlin/net/dankito/utils/multiplatform/File.kt b/common/src/jvmMain/kotlin/net/dankito/utils/multiplatform/File.kt index 9b2df165..8b2db6b7 100644 --- a/common/src/jvmMain/kotlin/net/dankito/utils/multiplatform/File.kt +++ b/common/src/jvmMain/kotlin/net/dankito/utils/multiplatform/File.kt @@ -37,6 +37,10 @@ actual class File actual constructor(path: String) : java.io.File(path) { return super.mkdirs() } + actual override fun delete(): Boolean { + return super.delete() + } + override fun toString(): String { return absolutePath