Closed BrianErikson closed 8 years ago
This sounds kind of like the issue we had in TheOregonTraj, where we had to wrap file-references in a function getFileDir(). Do we need to set up a class for that in this project?
So, the end result is that I had to copy the entire assets dir to the parent directory of the JAR, and then reference it through LIBGDX normally. Since gradle exports everything inside of the assets
directory to the classpath of the JAR, I had to put everything inside of a subdirectory called resources
.
When launching the JAR, the assets directory will be extracted to the working directory. This means that if your working directory parameter in IntelliJ is blank, it will attempt to copy the files to the root of the project I think. Below is an example of a working JAR configuration.
Nice work figuring this out. I'm so glad at least one of us can make some sense of gradle.
On Wed, Oct 21, 2015, 3:21 PM Brian Erikson notifications@github.com wrote:
Closed #84 https://github.com/EmergentOrganization/cell-rpg/issues/84.
— Reply to this email directly or view it on GitHub https://github.com/EmergentOrganization/cell-rpg/issues/84#event-441893429 .
Due to the way JARs are structured, Gradle puts all of the
../android/assets
folder contents into the root classpath of the JAR. This causes two issues:Gdx.files
, notJava.io
FileHandle.list()
to get contents of a directory due to the files being zipped into a JAR. This is in reference to dynamically loading all sounds located in thesounds/30s_arcade_loops/
directory for theBgSoundController
class.txt
file that we can reference during runtime to get a list of files located in a target asset directory