Hi! I'm having some issues with using Compose Reso...
# multiplatform
o
Hi! I'm having some issues with using Compose Resources to open a file located in my commonMain folder. When I run the following code inside of a viewmodel, I simply get a FileNotFoundException:
Copy code
...
init {
  viewModelScope.launch() {
    val ca = Res.getUri("files/ca.pem")
    ... // use the path to the file
  }
  ...
}
...
I have double-checked the file name and the file is where it's supposed to be. I even included the file in the androidMain/composeResources/files folder, it still cannot be found and I have no idea why. Especially since another file is read at another place in the code, which works without complains. Any ideas why that happens? EDIT: Issue has been fixed, was unrelated to Compose Resources but instead an issue with KMQTT.
p
Hi, how did you solve this @Oliver Schröder ? I'm having a similar issue: I'm trying to use Res.getUri to play a wav file, and I got
filenotfoundexception
when passing it to AudioSystem.getAudioInputStream:
Copy code
val uri = Res.getUri("files/frog.wav")
val audioInputStream = AudioSystem.getAudioInputStream(File(uri))