-
Notifications
You must be signed in to change notification settings - Fork 70
Closed
Labels
Description
Reproducer (works correctly on jvm and linuxX64 but fails on jsNode):
package tests
import kotlinx.io.files.Path
import kotlinx.io.files.SystemFileSystem
import kotlin.test.Test
import kotlin.test.assertTrue
class ReproducerTest {
@Test
fun test() {
// GIVEN
val testFileDirPath = "/tmp/test-0001"
val testFilePath = testFileDirPath + "/test-file.txt"
SystemFileSystem.createDirectories(Path(testFileDirPath), false)
assertTrue { isDirExist(testFileDirPath) }
// WHEN creating empty file
SystemFileSystem.sink(Path(testFilePath)).close()
// THEN
assertTrue { isFileExist(testFilePath) }
// CLEANING
SystemFileSystem.delete(Path(testFilePath), false)
}
fun isDirExist(directoryPath: String): Boolean {
return SystemFileSystem.metadataOrNull(Path(directoryPath))?.isDirectory ?: false
}
fun isFileExist(filePath: String): Boolean {
return SystemFileSystem.metadataOrNull(Path(filePath))?.isRegularFile ?: false
}
}