Hi I'm using Okio in my kotlin multiplatform app and frequently work with files on my devices.
One problem that occurs is that I have to combine paths, mostly a base path and a file name, e.g.
/home/userx/ + image.jpg
In pure Java I can simply do a Paths.get(/home/userx/, image.jpg) but I can't use this since I'm targeting the multiplatform approach.
To avoid issues with missing path separators, I'd like to use a library that does this for me but I can't find any function to do so in Okio.
Does anybody know more?
You can use the div operator (/
) for path operations. For example:
val userHome = "/Users/sandy".toPath()
val gitConfig = userHome / ".gitconfig"
For additional examples: documentation