bool LLInventoryFilter::checkFolder(const LLFolderViewModelItem* item) const { const LLFolderViewModelItemInventory* listener = dynamic_cast<const LLFolderViewModelItemInventory*>(item); if (!listener) { LL_ERRS() << "Folder view event listener not found." << LL_ENDL; return false; } const LLUUID folder_id = listener->getUUID(); return checkFolder(folder_id); }
/* * Если каталог не существует, то создать его... */ bool SysLibrary::UtilsLibrary::checkFolder( QString path ) { QDir folder( path ); if ( !folder.exists() ) { if ( !folder.cdUp() ) { QString path2 = path.left(path.lastIndexOf(QString("/"))); if ( checkFolder( path2 ) ) { if ( !folder.mkdir( path ) ) { return false; } } } else { if ( !folder.mkdir( path ) ) { return false; } } } return true; }
void Tulpa::loadByName(std::string name, bool load_sessions) { this->name = name; local_file = std::string(TULPA_FOLDER) + this->name + std::string(".json"); checkFolder(getFolder(local_file)); this->name[0] = toupper(this->name[0]); unsigned int i=0; if(!checkFile(local_file)) { root["personality_traits"] = Json::arrayValue; root["name"] = this->name; root["birth_time"] = (int)time(NULL); root["first_word_time"] = 0; saveJSONFile(root,local_file.c_str()); } root = loadJSONFile(local_file.c_str()); personality_traits.clear(); while(root["personality_traits"][i] != Json::nullValue) { addPersonalityTrait(root["personality_traits"][i].asString()); i++; } if(load_sessions) { i=0; while(root["session_id"][i] != Json::nullValue) { loadSession(root["session_id"][i].asInt()); i++; } } birth_time = root["birth_time"].asString(); first_word_time = root["first_word_time"].asString(); }
bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder) const { if (!folder) { llwarns << "The filter can not be checked on an invalid folder." << llendl; llassert(false); // crash in development builds return false; } const LLFolderViewEventListener* listener = folder->getListener(); if (!listener) { llwarns << "Folder view event listener not found." << llendl; llassert(false); // crash in development builds return false; } const LLUUID folder_id = listener->getUUID(); return checkFolder(folder_id); }