I’m porting my iOS / Android game to Windows and began to have a weird problem: the first time I run it on Visual Studio it runs without problems, but if I stop it and runs again, the games crashes the first time it attempts to play a mp3 file.
I realized createMappedCacheFile on CCWinRTUtils is returning an invalid path to the uncompressed .dat file:
C:/Users/Gustavo/Desktop/ (… a really long path …) /snd/opening.mp3
becomes
C:/Users/Gustavo/AppData/Local/ (…etc etc etc…) /LocalState//opening_13091xxxx…xxxxx.dat
because it tries to concatenate my writable path (getWritablePath() ends with ‘/’) with the mp3 file name returned by computeHashForFile (’/opening_lotsofnumbers’) and the .dat extension.
I know that some OSs recognize paths with double dashes, I think even previous Windows versions did. But now that’s a invalid path. Should computeHashForFile return the file name without the initial dash?
====
EDIT: also, the implementation of getFileSize is missing in CCFileUtilsWinRT. I made one from getStringFromFile.
long CCFileUtilsWinRT::getFileSize(const std::string &filepath)
{
Data data = getDataFromFile(filepath);
if (data.isNull())
{
return 0;
}
return data.getSize();
}