I'm trying to create a Sprite with SonarFrameworks, and get a null although my file is well integrated into the project.
I tried to add :
FileUtils::getInstance()->addSearchPath("res/");
And try with Content property set to "True" and "False" (default), but still same problem.
Any idea ?
Thanks to GandhiGandhi I found the solution :
In the function FileUtils::fullPathForFilename located in the file CCFileUtils.cpp, a added this
std::string search = searchIt;
int tail = search.size() - 10; // For replace /Resources
search.replace(tail, 9, "res");
After the first "for(...){", so like that I replaced the path to find my resources.
for (const std::string& searchIt : _searchPathArray)
{
std::string search = searchIt;
int tail = search.size() - 10; // For replace /Resources
search.replace(tail, 9, "res");
for (const auto& resolutionIt : _searchResolutionsOrderArray)
{
fullpath = this->getPathForFilename(newFilename, resolutionIt, search);
if (!fullpath.empty())
{
// Using the filename passed in as key.
_fullPathCache.emplace(filename, fullpath);
return fullpath;
}
}
}