In order to improve creating scripts without IDE support, adding this
typealias File = java.io.File
to the kotlin stdlib in the jvm part would be great, so we don't have to remember to add the import.
But I don't know if there are plans to add a real multiplatform
File
to the stdlib "soon"
c
CLOVIS
05/25/2023, 10:09 AM
The shortest code should be the most correct.
java.io.File
isn't even the modern way to deal with files on the JVM, and is not multiplatform. I don't think any helper of the sort should be added until there is a multiplatform file utility, whenever that is.
➕ 3
CLOVIS
05/25/2023, 10:10 AM
But I don't think it will ever happen as part of the standard library, because the idiomatic way to deal with I/O in Kotlin is probably through coroutines, and dispatchers etc are not part of the stdlib.
j
Javier
05/25/2023, 10:35 AM
A lot of kotlin stdlib extension functions are over
File
, that is the main reason I need that import when scripting
p
Paul Griffith
05/25/2023, 3:33 PM
there are just as many stdlib extensions over Path, and Path is the superior class is every way
➕ 1
y
yschimke
05/25/2023, 6:15 PM
For multiplatform, okio is probably the right way for most people.