Issues regarding CCFileUtils on Windows Phone 8

I have been building my project from android to Windows Phone 8 and seems like method

Getting file root path
string fileRoot = CCFileUtils::sharedFileUtils()->fullPathForFilename("dirName");
is having some issues on WP8. when i use this method on Windows/Android/iOS and give directory name as argument then it returns absolute path upto that directory but in WP8 it’s just returning the directory name only.

Also I have to read some level data files written in binary format using some tools and files have no extensions. When I read level file then it’s returning null while on other platforms everything is working fine. I have been using cocos2d-x-2.2 version.

Reading level data
unsigned long fileSize; char *fileData = (char*)CCFileUtils::sharedFileUtils()->getFileData("level1", "rb", &fileSize);

Same issue here … :slight_smile:

Working on it … will let you if i find a solution …
May be if you find … let us know the solution … :slight_smile:

Hey … found the solution :slight_smile:

When you create a new Windows Phone 8 project, you add assets to your project.
At this point you need to be sure when you are adding the asset into the project, each asset file should be marked as " Content " and " included in the build option is true ".

Until you do this, the XAP file will not copy these files into the package and hence will get error from CCFileUtils - file path cannot be found. As you are running your project on emulator it will always check files in the Asset folder of XAP package.

Hope this helps.
Cheers :slight_smile:

check out my new game:
Song of Swords

No it works only for the known file types. I have some proprietary binary files without extensions and if you add them as existing item then it will add file but you wont be able to change the properties then it throws error.Check out the screenshots.

Hey …

I think you are tweaking at the wrong place.
I will explain with an example:

Lets say you have a file " test.LEVEL "
Now in your Solution Explorer > right click on " test.LEVEL " and select properties
In the properties check if the file has property
" Content " set to true.
also check if the property - " Include in Build " set to true.

That should be enough.
If you still don’t get it, please let me know which version of Visual Studio you are using

  • 2012, 2013 ? There might be some difference in the presentation of property windows.
    I myself am using VS 2013

Cheers :slight_smile:

Thank you for the clarification. It was not working with Visual Studio 2012 for Windows Phone 8 Now I have tried with Visual Studio 2013 RC and everything is working fine.

By the way if you give directory name as an argument in the method:
CCFileUtils::sharedFileUtils()->fullPathForFilename("dirName"); then it returns the directory name itself while in Android, iOS, Windows it returns full path of that directory.

Hey,

So is your problem solved or still stuck with the same?

Cheers
check out my new game:
Song of Swords
[[http://www.cocos2d-x.org/forums/21/topics/36009?r=36084#message-36084]]