Hey ~I’m trying to use `pathForResource` to access...
# multiplatform
r
Hey I’m trying to use
pathForResource
to access a json file asset but it keeps returning
null
as path, apparently not finding the file
here is my code
Copy code
val path = NSBundle.mainBundle.pathForResource("../resources/data.json", ofType = "json") // tried "resources/data.json" and just "data.json" as well
but didn’t work my data.json file is in commonMain/resources Update:
Copy code
val path = NSBundle.mainBundle.pathForResource("data", ofType = "json")
this worked 🙌
🙌 1
or wait I probably shouldn’t have added
.json
will try again