bool ScriptingManager::loadMods() { boost::filesystem::path modsPath(getFilePath(FILE_TYPE_MOD, "")); if(!boost::filesystem::exists(modsPath)) return true; //silently ignore int32_t i = 0; for(boost::filesystem::directory_iterator it(modsPath), end; it != end; ++it) { std::string name = it->leaf(); //deprecated in newer version of boost, use filename() if compilation fails even if deprecations aren't disabled if(!boost::filesystem::is_directory(it->status()) && name.find(".xml") != std::string::npos) { bool enabled; std::cout << "Loading " << name << "..."; if(loadFromXml(name, enabled)) { std::cout << " done"; if(!enabled) std::cout << ", but disabled"; std::cout << "."; } else std::cout << " failed!"; std::cout << std::endl; ++i; } } std::cout << "> " << i << " mods were loaded." << std::endl; modsLoaded = true; return true; }
bool ScriptManager::loadMods() { boost::filesystem::path modsPath(getFilePath(FILE_TYPE_MOD)); if(!boost::filesystem::exists(modsPath)) { std::clog << "[Error - ScriptManager::loadMods] Couldn't locate main directory" << std::endl; return false; } int32_t i = 0, j = 0; bool enabled = false; for(boost::filesystem::directory_iterator it(modsPath), end; it != end; ++it) { std::string s = it->leaf(); if(boost::filesystem::is_directory(it->status()) && (s.size() > 4 ? s.substr(s.size() - 4) : "") != ".xml") continue; std::clog << "> Loading " << s << "..."; if(loadFromXml(s, enabled)) { std::clog << " done"; if(!enabled) { ++j; std::clog << ", but disabled"; } std::clog << "."; } else std::clog << " failed!"; std::clog << std::endl; ++i; } std::clog << "> " << i << " mods were loaded"; if(j) std::clog << " (" << j << " disabled)"; std::clog << "." << std::endl; modsLoaded = true; return true; }
bool ScriptingManager::loadMods() { boost::filesystem::path modsPath(getFilePath(FILE_TYPE_MOD, "")); if(!boost::filesystem::exists(modsPath)) return true; //silently ignore int32_t i = 0, j = 0; bool enabled = false; for(boost::filesystem::directory_iterator it(modsPath), end; it != end; ++it) { std::string s = BOOST_DIR_ITER_FILENAME(it); if(boost::filesystem::is_directory(it->status()) && (s.size() > 4 ? s.substr(s.size() - 4) : "") != ".xml") continue; std::cout << "> Loading " << s << "..."; if(loadFromXml(s, enabled)) { std::cout << " done"; if(!enabled) { ++j; std::cout << ", but disabled"; } std::cout << "."; } else std::cout << " failed!"; std::cout << std::endl; ++i; } std::cout << "> " << i << " mods were loaded"; if(j) std::cout << " (" << j << " disabled)"; std::cout << "." << std::endl; modsLoaded = true; return true; }
CLauncherDirs::CLauncherDirs() { QDir().mkdir(downloadsPath()); QDir().mkdir(modsPath()); }