Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ import platform.Foundation.NSURL

public fun NSURL.toKotlinxPath(): Path = this.path
?.let(::Path)
?: absoluteString
?.takeIf(String::isEmpty)
?.let(::Path)
?: throw FileKitNSURLNullPathException()
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ class PlatformFileNonWebTest {
assertTrue { resourceDirectory.exists() }
}

@Test
fun PlatformFile_deleteEmptyPathWithMustExistFalse_doesNothing() = runTest {
PlatformFile("").delete(mustExist = false)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid running this iOS-only regression on JVM

This test lives in the shared nonWebTest source set, which is wired into jvmTest as well as native tests. On JVM, PlatformFile("") wraps java.io.File(""), i.e. the current working directory; because it exists, delete(mustExist = false) still attempts File.delete() and a non-empty checkout returns false, causing IOException("Deletion failed") and breaking :filekit-core:jvmTest/check. Please scope this regression to Apple/native or make JVM handle empty paths consistently before sharing the test.

Useful? React with 👍 / 👎.

}

@Test
fun testPlatformFileReadBytes() = runTest {
val textFileContent = textFile.readString()
Expand Down