Search code examples
kotlinkotlin-multiplatformkotlin-nativeokio

Okio native/multiplatform default paths


How do one access the common default paths using okio?

The paths I'm specifically interested in are:

  • Application directory (location of the executable(s) that are being run)
  • Working directory (where the app is run from, seems that it's relative to the FileSystem?)
  • Temporary directory

For the temporary directory I found FileSystem.SYSTEM_TEMPORARY_DIRECTORY, is this the correct/best way?

Can I, as I suspect get working directory by assuming that it's local to the FileSystem, if so, is this reliable, or just how it happens to be right now?

What about the application directory?

I've seen that a users home directory isn't implemented due to the ambiguity of it, and issues with platforms such as Android where the notion of a home directory is a bit weird. And for that reason I suspect there's no direct helpers/variables in okio, and that I need to work around the system directly, is that correct?


Solution

  • Application directory (location of the executable(s) that are being run)

    No clue. What would you use with java.nio?

    Working directory (where the app is run from, seems that it's relative to the FileSystem?)

    I think you could work with ".".toPath(), does it not work?

    Temporary directory

    As you said, FileSystem.SYSTEM_TEMPORARY_DIRECTORY.