How should i seperate files into folders and not break the build?

I’m making an android game and the code has been getting really messy.
I wanted to separate the code and data into separate directories inside the main project folder (MyProject/Sprites, MyProject/Sounds, MyProject/Objects etc…).
It works no problem when i run it in the emulator but when i build the .apk file i get runtime error that indicates that my data is missing.

Is there a way to somehow include files from other folders into a final build?

Anyone had any experience with this?

Placing files in folders is fine and will work in builds. Without seeing your code, there is one thing I can think of that can commonly break the build, check your code for uppercase and lowercase characters as it must match the actual files and folders… As mentioned in your post I believe the emulator ignores the uppercase/lowercase but builds do not and will cause an error.

1 Like

I dont think casing is the issue since i belive i got that right… Here is the repo if you want to check it out GitHub - mihna123/MyLittleFarm maybe see if you can build it?

This repo is not seperated in the folders. If in the version which you have folders eg /Sprites
And in your code you reference /sprites
The build will result in an error.

He’s got a dev branch with the separation: GitHub - mihna123/MyLittleFarm at dev

I’m not sure whether it’s stated anywhere or not, but can probably be made clear somewhere…
For any file paths use / instead of \\, so: Sprites/start.png instead of Sprites\\start.png.

Backslashes are a Windows thing. Windows also supports forward slash, thus always use forward slash, that works on all supported platforms.

That was it! Thank you very much

Also: if you put any of your Lua scripts into subfolders, you need to use . instead of / when you require them:

local myFile = require("mySubfolder.myFile")

Yeah i was lucky with that since the lua extension did that for me, but thanks on the feedback