Resource folder structure

Resource folder structure
0

#1

Hey,
I’ve recently tried to put textures in seperate folders so I have to enter a relative path to get textues, this would let me use the same name for multiple different textures.

Sprite::create(“menu/simple_button.png”)
Sprite::create("core_ui/simple_button.png)

this is even more interesting for shipping data resource files, since its more likley to have the same name in different hierarchies there. This seems to work fine on all platforms except ios?
because in xcode the folders a created as groups by default i think, therefore all textures in a hierarchy end up in the same folder for ios. I would get around this by adding the Resources folder as Reference, but it seems like it is not allowed to have a folder named “Resources” since apple already ships one with this name.

Not sure if I can simply rename the resources folder with out getting other issues.

Has anyone any advice?


#2

You should not rename resources.

Can you post a screenshot of your structure on the file system and in Xcode, please.


#3

currently its a little bit chaotic but the main idea is just to have subfolders like the default font folder.
I’m not adding subfolders to the searchpaths so i should have to enter the full path inside the Resource folder:

create(“font/xxxx”)

But this seems not to work with the resource folder added as Groups to the ios xcode project(which i think is default)
When looking at the Resource folder when the project is built it seems like all resources are put into one folder so they loose their subfolder hierarchy, therefore I can’t use hierarchy folder paths.

I found solutions with adding the Resources folder as reference but then I additionally have to add the Resources folder to the search paths(which isn’t a problem).

Using Reference Resources also created an error: code object is not signed at all
And google searches say this might be an issue with an custom folder named Resources, because it is conflicting with apples resources folder.

Maybe I’m just doing something wrong, usually i just add everything to the search paths and never add folder names when creating sprites or what ever. but I kinda wanna changed that to be since it allows me to be more flexible and more specific.


#4

is there anyway to support a real folder hierarchy for ios, so i can name stuff “fonts/xxxx.ttf” to allow me having the same file name multiple times in different prefixes, atm i just reverted everything and just make sure i have unique resource namesm since they all end up in the same folder in ios


#5

Just put that structure in Resources/?


#6

if you mean by putting the structures in resources like this in the Finder/Explorer:

Thats what my structure would be for example in the Projectfolder.

and the picture above was the project displayed in XCode as folder reference. By default the Resources are added as Groups instead of references, and this way they end up all in the ios Resourcefolder and the whole structure/hierarchy is gone, thats why i cand use the fonts prefix anymore. I could only add it as Referenced Resource folder in XCode to be able to use the prefix for ios, which then would conflict with the ios Resource folder.


#7

I’ve tried to check this issue out again,
as I remember the main issue here was that the whole folder hierarchy is removed and every file from subfolder ends up in a “/Resource” folder of the app.

so for exanple

from the last post files from Resources/fonts/myfont.ttf , Resources/Levels/lvl1.txt
would end up in .

MyApp/Contents/Resources/myfont.ttf
MyApp/Contents/Resources/lvl1.txt

this prevented me from adding folder prefixes to files and having files with the same name, if I wanted to have those, since the folders are just added as Groups instead of references in XCode

This can be prevented by adding the Resource folder as references to XCode, this would copy the whole hierarchy to the app but this would cause singing issues on iOS for some reasons, as I remember I read in a stackoverflow post that the issue might be the resource folder name being “Resources” because iOS already has a folder named Resources and doesn’t allow the same name, even though it just says signing issue in XCode without any info.

But I’ve fixed this by just renaming the Resources folder to something else like “ResourceFiles”.

This fixes my issue with signing and the rest.

But if anyone has an better approach let me know, maybe I get stuff wrong with the Resource files here.


#8

I want to add, this issues might also be solved by using cmake for your project, since you can controll there how the resources should get copied over to the final product(.app) .