What is a good approach of iterating the files in ...
# getting-started
a
What is a good approach of iterating the files in package/folder inside your resources? When jarring it isn’t a regular file system anymore. And I don’t know how I can test that
c
Unzip the JAR and see how it looks like Most likely you're getting the typical Java resource confusion: resources are grouped in packages, like source code
So, depending on whether you're using a
ClassLoader
or something else to read the resources, it expects them to be in a different place Some info: https://opensavvy.gitlab.io/groundwork/prepared/api-docs/compat/compat-filesystem/opensavvy.prepared.compat.filesystem.resources/resource.html
a
Thanks, but I wasn't clear I think. I know what the resources structure looks like. I make it myself 😉 But I was wondering how, at runtime, I can iterate the resources inside a resources subpackage. When developing it is easy, because the resources are just folders. But after applying the aplication plugin it is jar'ed and it behaves as source code. The problem I have then is two-fold: 1. how do I navigate files inside the JAR at runtime 2. how do I test this behavior if it only works after applying the
application
plugin. How would I write a test for this?
c
To my knowledge, you can't navigate the contents of the resources. There is no guarantee that the resources are actually files. When the JVM starts, you may specify multiple JARs, including JARs on remote servers, etc.
a
Okay clear! That actually makes sense