fishy fish
12/18/2023, 11:31 AMval resourcesDir = File(System.getProperty("compose.application.resources.dir"))
val plainText = resourcesDir.resolve("csv\\countries.csv").readLines()
The structure of the project:
/composeApp
├── resources
│ ├── common
│ │ ├── csv
│ │ │ ├── countries.csv
├── src
│ ├── desktopMain
│ │ ├── kotlin
│ │ │ ├── repository
│ │ │ │ ├── data
│ │ │ │ │ ├── CountriesAndContinents.kt
When building with ./gradlew packageDistributionForCurrentOS i get an executable but it also generates app and runtime folders.
I tried building a .jar and packaging it with launch4j, but the generated .exe cannot find the resource file.
I tried with:
javaClass.getResource("composeApp/resources/csv/countries.csv")
javaClass.getResource("/compose/application/resources/csv/countries.csv")
But both calls return null.ephemient
12/18/2023, 11:35 AMsrc/desktopMain/resources/your/package/name/csv/countries.csv
, you can access it with `your.package.name.AnyClass.getResource("csv/countries.csv")`/`.getResourceAsStream()`fishy fish
12/18/2023, 12:09 PMOluwafemi Ogundipe
12/18/2023, 12:12 PMfishy fish
12/18/2023, 12:23 PM