Path.parent utilizes isBlank() when checking returned value from dirname. This is incorrect, as a parent directory can be created as just a space.
The following assertion should pass:
assertEquals(" ", Path(" /.").parent?.toString() ?: "NULL")
Which is the same behavior as Jvm's java.io.File
If java.io.File behavior (the underlying on Jvm) is desired to be mimicked for Native, the dirname check should be:
val parentName = dirnameImpl(path)
return when {
parentName.isEmpty() -> null
parentName == "." -> null
parentName == path -> null
else -> parentName
}