Manuallly
Since you’re looking at the resource directory, this means the files there will never change after the build. So, the easiest way is to do this is manually. i.e. Create a table somewhere in your code with paths to all the files.
Dynamically
Of course, if you’re like me, you may prefer to have your game code do this for your. So, if you change file names, add files, remove files, the game code ‘adjusts’ while you develop.
You can do this too.
Just write a snippet of code that executes every time main.lua is executed and structure it like this:
If on simulator, discover all files in folder, save <relative> paths in a table, json encode the table, and write it to a file.
... later
Load the file as needed, json decode it, and violla you have a list of files in the path/folder.
Now, every time you run your game in the simulator, it will rebuild the file and then use it. However, when you build the game and distribute it, the game will skip the generate step (on the device) and use the last written file (from the last simulator run), because all files LUA, TXT, PNG, etc are included in the build.
SSK has all the code needed to do the individual steps:
Since you have most of the code already, the only trick is to know when you’re on the simulator or not:
_G.onSimulator = system.getInfo("environment") == "simulator"
above taken from: https://github.com/roaminggamer/SSK2/blob/master/ssk2/core/variables.lua