Recently I’ve ran into a big problem with pugiXml.
Shortly, I’ve made a quiz game. I keep my questions (and some other data) in an Xml file. On new game they get parsed and inserted into dictionaries. If a question is answered, a short string indicating the answer (whether it was good or not - Y/N) is inserted into that Xml file (below that particular question). Later, I use this data to show statistics (I count the percentage of questions with good answers - which is counting the amount of Y’s divided by the amount of questions, multiplied by 100).
CCFileUtils::sharedFileUtils()->fullPathForFilename(o_QA); to get the file and later
pBuffer = CCFileUtils::sharedFileUtils()->getFileData(fullPath.c_str(), "rb", &bufferSize); to put file into buffer and
pugi::xml_parse_result result = doc.load_buffer(pBuffer,bufferSize); to parse data and start working on it.
Finally, I save the file with:
- It’s working very well, although I had to copy the file with questions to /data/data/app/Files/ . Still, It’s keeping the changes on many devices.
- Unfortunately, on iOS it’s not working. Data get loaded and parsed (which means, that I can actually play the game), but they are not saved. I’ve tried moving the files to other folders (started from Documents, then main Resources folder, Library/Application Support in Resources folder). It’s still not saving the data and I don’t know what to do. The result is my statistics not being counted well (it doesn’t matter how you answer the questions - all of them are false, because the Xml file is not being updated).
Did anyone run into similar problem?
Can you, please, help me?