I have a list of public assets inside the "src/main/resources" folder that looks like this:
public/images/
- asd1.png
- asd2.png
I'm trying to list all the files inside the "public/images/" directory, as it is a compiled project using sbt universal:packageBin
I'm trying to access the assets using:
val input = getClass.getResourceAsStream("/public/images/")
or
val input = getClass.getResource("/public/images/")
getResourceAsStream
returns an empty result and getResource
returns a URL object that contains a direct path to the folder but I cannot list anything inside that folder even with new File(getClass.getResource("/public/images/"))
as the check for .isDirectory()
returns a false
as a response or .listFiles()
throws an exception.
What is the best way to achieve this?