Saving map to file results in semi-empty plist file? Is this implemented in the beta yet?

Saving map to file results in semi-empty plist file? Is this implemented in the beta yet?
0

#1

Using Cocos2d-x 3.0 Beta:
I have a ValueMap that I want to save using this method:

std::cout << "map value: " << _map.at(KEY_FILE_VERSION).asFloat() << "\n"; successFlag = _fileUtils->writeToFile(_map, _writablePath);

This cout prints: “map value: 5” as it should, so I know the map has the value.

In addition the file is saved to my docs directory. However, the file looks like this:

`<?xml version="1.0" encoding="UTF-8"?>

`

The tests in the beta still use Dictionary for the FileUtils plist test, so is this feature not implemented yet?


Feedbacks of v3.0-beta
#2

As far as I can tell, the Value has be created with a Value::Type::STRING type or it gets ignored when writing to file.

I’ve got to say that it doesn’t make all too much sense that it’s being checked like that because non-VECTOR/MAP/INT_KEY_MAP types should theoretically get their respective string values returned correctly by the stringstream.


#3

Tested and works. I will have to setup my code to convert the values. Here’s to hoping it’s changed in the future, but I think it’s a low priority thing for the devs anyway right now, as it’s not so important.

Thanks rivm