void LLWLParamManager::savePreset(const std::string & name) { // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_escape(name.c_str(), name.size()); std::string escaped_filename(curl_str); curl_free(curl_str); curl_str = NULL; escaped_filename += ".xml"; // make an empty llsd LLSD paramsData(LLSD::emptyMap()); std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename)); // fill it with LLSD windlight params paramsData = mParamList[name].getAll(); // write to file llofstream presetsXML(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); propagateParameters(); notifyObservers(); }
void LLWLParamManager::savePresets(const std::string & fileName) { //Nobody currently calls me, but if they did, then its reasonable to write the data out to the user's folder //and not over the RO system wide version. LLSD paramsData(LLSD::emptyMap()); std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", fileName)); for(std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.begin(); mIt != mParamList.end(); ++mIt) { paramsData[mIt->first] = mIt->second.getAll(); } llofstream presetsXML(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); propagateParameters(); }
void LLWLParamManager::loadPreset(const std::string & name) { // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_escape(name.c_str(), name.size()); std::string escaped_filename(curl_str); curl_free(curl_str); curl_str = NULL; escaped_filename += ".xml"; std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", escaped_filename)); llinfos << "Loading WindLight sky setting from " << pathName << llendl; llifstream presetsXML(pathName); if (presetsXML) { LLSD paramsData(LLSD::emptyMap()); LLPointer<LLSDParser> parser = new LLSDXMLParser(); parser->parse(presetsXML, paramsData, LLSDSerialize::SIZE_UNLIMITED); std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.find(name); if(mIt == mParamList.end()) { addParamSet(name, paramsData); } else { setParamSet(name, paramsData); } presetsXML.close(); } else { llwarns << "Can't find " << name << llendl; return; } getParamSet(name, mCurParams); propagateParameters(); }
void LLWLParamManager::savePreset(LLWLParamKey key) { llassert(key.scope == LLEnvKey::SCOPE_LOCAL && !key.name.empty()); // make an empty llsd LLSD paramsData(LLSD::emptyMap()); std::string pathName(getUserDir() + LLWeb::curlEscape(key.name) + ".xml"); // fill it with LLSD windlight params paramsData = mParamList[key].getAll(); // write to file llofstream presetsXML(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); propagateParameters(); }
void LLWaterParamManager::savePreset(const std::string & name) { llassert(!name.empty()); // make an empty llsd LLSD paramsData(LLSD::emptyMap()); std::string pathName(getUserDir() + LLURI::escape(name) + ".xml"); // fill it with LLSD windlight params paramsData = mParamList[name].getAll(); // write to file llofstream presetsXML(pathName.c_str()); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); propagateParameters(); }
void AscentDayCycleManager::savePreset(const std::string & name) { // bugfix for SL-46920: preventing filenames that break stuff. std::string escaped_filename = LLWeb::curlEscape(name); escaped_filename += ".xml"; // make an empty llsd LLSD paramsData(LLSD::emptyMap()); std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/days", escaped_filename)); // fill it with LLSD windlight params //paramsData = mParamList[name].getAll(); // write to file llofstream presetsXML(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); }
void LLWaterParamManager::savePreset(const std::string & name) { std::string escaped_filename = LLCurl::escapeSafe(name); escaped_filename += ".xml"; // make an empty llsd LLSD paramsData(LLSD::emptyMap()); std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", escaped_filename)); // fill it with LLSD windlight params paramsData = mParamList[name].getAll(); // write to file llofstream presetsXML(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); propagateParameters(); }
void LLWLParamManager::savePresets(const std::string & fileName) { LLSD paramsData(LLSD::emptyMap()); std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", fileName)); for(std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.begin(); mIt != mParamList.end(); ++mIt) { paramsData[mIt->first] = mIt->second.getAll(); } llofstream presetsXML(pathName); LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); }
void LLWLParamManager::loadPresets(const std::string& file_name) { // if fileName exists, use legacy loading form the big file, otherwise, search the sky // directory, and add the list if(file_name != "") { std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", file_name)); LL_INFOS2("AppInit", "Shaders") << "Loading WindLight settings from " << path_name << LL_ENDL; llifstream presetsXML(path_name); if (presetsXML) { LLSD paramsData(LLSD::emptyMap()); LLPointer<LLSDParser> parser = new LLSDXMLParser(); parser->parse(presetsXML, paramsData, LLSDSerialize::SIZE_UNLIMITED); LLSD::map_const_iterator endParams = paramsData.endMap(); for(LLSD::map_const_iterator curParams = paramsData.beginMap(); curParams != endParams; ++curParams) { addParamSet(curParams->first, curParams->second); } } } // otherwise, search the sky directory and find things there else { std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); LL_INFOS2("AppInit", "Shaders") << "Loading WindLight settings from " << path_name << LL_ENDL; //mParamList.clear(); bool found = true; while(found) { std::string name; found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name, false); LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL; // if we have one if(found) { // bugfix for SL-46920: preventing filenames that break stuff. char * curl_str = curl_unescape(name.c_str(), name.size()); std::string unescaped_name(curl_str); curl_free(curl_str); curl_str = NULL; // not much error checking here since we're getting rid of this std::string sky_name = unescaped_name.substr(0, unescaped_name.size() - 4); std::string cur_path(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", name)); LL_DEBUGS2("AppInit", "Shaders") << "Loading sky from " << cur_path << LL_ENDL; llifstream sky_xml(cur_path); if (sky_xml) { LLSD sky_data(LLSD::emptyMap()); LLPointer<LLSDParser> parser = new LLSDXMLParser(); parser->parse(sky_xml, sky_data, LLSDSerialize::SIZE_UNLIMITED); addParamSet(sky_name, sky_data); sky_xml.close(); } } } } }