We've had some users experience this issue and I've confirmed it myself. Our avionics suite are designed in webassembly and save user settings to a file in the /work directory. When a change is made, I've verified that the file is updated correctly, so it seems the path is good. But when restarting the flight, none of the settings are read again.
The strangest part of this is that the same aircraft offered on justflight works just fine. I even threw the exact package that I uploaded to Microsoft in my community folder, persistent data works just fine. All of the settings are read and saved as expected.
It appears that something in the encryption process or some other step that Microsoft/Asobo do to prepare our product for the Marketplace is breaking this feature. If anyone has any experience with this issue and a possible workaround, that'd be a tremendous help.
--Edit: I should specify that this has only become an issue in the last month or so. It worked fine when the product was originally submitted and tested.
-- Edit 2: Adding abbreviated code from source:
I'm using fstream.
For reading:
bool Config::init() { std::ifstream pers_data_file("/work/pers_data.cfg", std::ios::in); std::string line; if (!pers_data_file.is_open()) // if file doesn't exist, it will when writePersData() is called return true; while (getline(pers_data_file, line)) { if (line.find("PMFD_page") != -1) { std::istringstream sin(line.substr(line.find("=") + 2)); sin >> pers_data.PMFD_page; } // Loop continues for the rest of the variables } pers_data_file.close(); return true; }
.
For writing:
bool Config::writePersData() { std::ofstream pers_data_file("/work/pers_data.cfg", std::ios::out); if (!pers_data_file.is_open()) { return false; } std::string buff = "PMFD_page = " + std::to_string(pers_data.PMFD_page); pers_data_file << buff << std::endl; // Continues writing the rest of the variables return true; }
Can't figure out how indentation works with code blocks on this website, so please forgive the readability issues.