HTML5 - CCFileUtils.js doesn't recognize full path

HTML5 - CCFileUtils.js doesn't recognize full path
0.0 0


The fullPathForFilename function doesn’t seem to recognize when it’s presented with a full path. I wonder if line 420

if (newFileName && newFileName.length > 1 && (newFileName.indexOf(":") == 1))

needs to be amended to something like:

if (newFileName && newFileName.length > 1 && (newFileName.indexOf(":") != -1))

This fix seems to work for me.


I’m sorry, this is my mistake when I was migrating code from -x.

The condition (newFileName.indexOf() == 1)" is used to determine whether it is a full path in cocos2d-x on Window platform, for example: “e:.png”;

It doesn’t need this judgment in Cocos2d-html5.
You can remove this condition. I will delete it in next version.

Thanks for your feedback, Will.


Thanks for the quick response.
Now I understand the original intent. I assumed it was looking for the colon after the protocol in a non-relative web address, e.g.:

But doesn’t just deleting the condition return any filename as if it were a full path?