int Daemon::loadValuesFile (const char *filename) { if (filename == NULL) return 0; IniParser *autosave = new IniParser (true); int ret = autosave->loadFile (filename); if (ret) { logStream (MESSAGE_WARNING) << "cannot open autosave file " << filename << ", ignoring the error" << sendLog; return 0; } if (autosave->size () == 0) { logStream (MESSAGE_WARNING) << "empty autosave file. Perharps you should set some values with RTS2_VALUE_AUTOSAVE flag?" << sendLog; return 0; } ret = setSectionValues ((*autosave)[0], 0, false); delete autosave; return ret; }
int Daemon::loadCreateFile () { if (valueFile == NULL) return 0; IniParser *created = new IniParser (true); int ret = created->loadFile (valueFile); if (ret) { logStream (MESSAGE_WARNING) << "cannot open values file " << valueFile << ", probable cause " << strerror (errno) << sendLog; return -1; } if (created->size () == 0) { logStream (MESSAGE_WARNING) << "cannot find any value to create" << sendLog; return 0; } ret = createSectionValues ((*created)[0]); delete created; return ret; }