Move Resources folder - how do I reflect the change on iOS devices?

Hello!

I need to move my Resources folder because of how I want to structure my project into sub-modules and such.

I have managed to fix it in the Android version and it builds and runs well. It does not on iOS however, and I can understand that because I have not updated anything for the iOS version yet. I can’t find where to do so. Another thread talked about doing this by overriding FileUtilsApple::init or something and making the desired change there, but I don’t think that’s related or what I want.

I need to map the new destination to be my new root. Meaning ./Resources -> ./game/Resources, for example. So at the root of my git repository I now have any arbitrary folder structure that will contain my actual Resources folder. How do I make sure the the Resources are included in the bundle at the desired level?

For me, this is a not a great idea. I have a git repo that contains all my art work for games. I use a script to copy in specific art for each game into Resources. This way it is controlled and no extra resources get copied in or none left out.

Resources is where your work needs to be. Change this and I think you will get bit down the road eventually. What you can do is also symlink, but I don’t like this idea either.

For you, sure. For me, it is a good idea.

So how do I do it? I need to restructure this for my building processes and I’d expect it to be more configurable than what it is now.

How will it bite me later on?

The idea is that eventually I want to be able to compile the actual game code separately from the engine code. I will make the cocos2d folder be a git submodule such that I can compile that only when necessary (I do sometimes introduce tiny changes and can’t thus rely on the pre-compile binaries). The next step is to make the game/Classes folder be made a separate module as well. And the reason for moving the Resources has to do with this. I want to be able to have a git submodule in the game folder so that when I have a TravisCI build setup it will be able to pull in any game, independently of platform and game classes, e.t.c.

The idea is to save compile times and make it easier to create new games with the same building processes (just copy the repo, change the repo URL, setup travis and point to a new git submodule that will contain Resources and Classes). That’s why I want to wrap those two folders in one folder. Otherwise I’d have to have two submodules, one for each.

XCode requires Resources directory, AFAIK. I have never been able to move it (without a symlink called Resources).

I do what you are doing with a script to move things around. I have just an art repo, shared cocos2d-x repo, shared libraries amongst projects. I even have shared classes amongst projects. XCode is very fussy though which is where the unexpected behavior comes in.

So you are saying that if I made a new XCode project and added some resources to it, say some fonts or audio files, they would automatically have to be placed in Resources in the root of my project?

This is the only project (Cocos2D-x) I’ve seen this structure in, but I have to admit that I have never really added any audio files or such before. Images I have handled through their image assets thing.

I made my structure mostly. If you add resources they are placed in Resources automatically. Resources is dynamic, place stuff in it and it shows up. Just then need to add to your build phase. I dont recall if that happens automatically.

In the pic above these are all separate GitHub repos.

I might for now get away with keeping the Resources in the root but it would simplify my packaging and encapsulation later on, when I get to the stage I want to be at with it.

Thanks for the help though! :slight_smile:

If I can help with any thoughts, please let me know.

1 Like