Today I tried to read something from a plist file but it didn’t work. I just need the game to know if something was set to true or false when the game launches. For that I googled some stuff about reading from plist but I was stuck right here:
What’s the error? Does the file in correct path?
I think you should use FileUtils::writeValueMapToFile and FileUtils::getValueMapFromFile:
std::string path = FileUtils::getInstance()->getWritablePath() + "mysettings.plist"; ValueMap map; map["hello"] = "world"; map["answer"] = 42 FileUtils::getInstance()->writeValueMapToFile(map, path); ValueMap readMap = FileUtils::getInstance()->getValueMapFromFile(path); log("hello: %s, answer:%d", readMap["hello"].c_str(), readMap["answer"]);
That’s amazing, i finally got it working. This is the best answer I’ve got so far. I messed around with it and I finally got what I wanted. I really appreciate it!
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.