Get data from file failed, even on iOS.

Hello.

I use this to load a file:

@ CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(“file.ext”));
@
Then I put file.ext in Resources folder and I add it in Build Settings, but I still get “Get data from file(file.ext) failed”.

What am I doing wrong? Thanks.

Anyone?

I’m trying this, but it’s not working. I’m trying to load a shader.

std::string m_sPlistFile = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(“CSEColorRamp.fsh”);

std::string fullpath = CCFileUtils::sharedFileUtils()->fullPathFromRelativeFile(“CSEColorRamp.fsh”, m_sPlistFile.c_str());

GLchar * fragmentSource = (GLchar*) CCString::createWithContentsOfFile(
CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(fullpath.c_str()));

If anyone’s wondering, I managed to load the shader by copying its content directly, like this:

GLchar * fragmentSource = (GLchar*) " #ifdef GL_ES precision mediump float; #endif varying vec2 v_texCoord; uniform sampler2D u_texture; uniform sampler2D u_colorRampTexture; void main() ";

But I also need to use CCFileUtils for something else. I hope somebody helps me out here :slight_smile: