Cocos2d-x v3.6 Issues with FileUtils search path - it works on simulator but not in the iphone

Hi guys,
I’m having issues with the search path.
I’m setting the path as per resolution:
searchPaths.push_back(“iphone6plus”);
searchPaths.push_back(“iphone5”);
etc…
my folder structure is:
Resources/iphone6plus/assets/mainmenu
Resources/iphone6plus/assets/…menu
Resources/iphone5/assets/mainmenu
Resources/iphone5/assets/…menu

And I’m accessing my images as “assets/mainmenu/bg.png” etc…

The issue I’m encountering with cocos2d-x v3.6 is that on the ios simulator, this works great for iphone 5, 6, 6+ etc…
But when I try to run in the actual device it fails as the images are not found, it’s like for some reason it ignores the searchpath I’ve added, eve if I set the searchpath order.

Then I’ve have to create a folder reference of my “asset” folder into Resources to make it work in the device…

Has anyone notice this?

@madmax

You have to add references to all Resources folders if you want it to work on device. So ? Whats the problem/issue here? It’s pretty normal.

hmm, I’m not sure if you understood that I’ve added all the resources root folders into the search path.
And as per the documentation and all examples I found so far I only have to add the root folder into the search path and specify the search order.

Like:
searchPaths.push_back(“iphone6plus”);
searchPaths.push_back(“iphone5”);

I don’t have to put any subfolders under say “iphone6plus” in the search path as I’m loading the sprite images like this “assets/mainmenu/bg.png”.

and again, this works well in the simulator and doesn’t work in the device unless I move the assets folder to be directly under Resources.

Anyway, thank you for trying to help.

@madmax

I just tested and everything worked fine for me. I used search paths hd, sd, ld and I placed test images in hd/folder ld/folder sd/folder and when I was creating sprites from “folder/sprite.png” it worked.

So I recommend you to try delete all folders and re-add them with references.

Hi Edvinas,
I found out what the problems. It seems there is bug in the cocos2d-x with FileUtils. I noticed that if you have path or file in camel case, like "images/backgroundAll/all.png" and call it like “images/backgroundall/all.png” it somehow works on the iOS simulator but fail on the iphone.
I figured this out because I renamed all my folders to lower case only and everything started working as expected. Then I created a new scene and by mistake I created the sprite with camel case folder again, but the actual folder name was all lower, it worked on the simulator but didn’t work on the iphone, it took me hours to notice the spelling difference between the folder name and my code.

Try changing in your code to “Folder/sprite.png” and see what happens.

Thanks for the help!