void Campaigns::findCampaigns() { status("Looking for campaigns..."); const Common::UString baseDir = ResMan.getDataBase(); // Single player const Common::UString spDir = Common::FilePath::findSubDirectory(baseDir, "modules/campaign_base", true); const Common::FileList spFiles(spDir, -1); addCampaign(readCampaign(spFiles.findFirst("campaign_base.cif", true))); // DLCs const Common::UString dlcDir = Common::FilePath::findSubDirectory(baseDir, "addins", true); std::list<Common::UString> dlcDirs; Common::FilePath::getSubDirectories(dlcDir, dlcDirs); for (std::list<Common::UString>::const_iterator d = dlcDirs.begin(); d != dlcDirs.end(); ++d) { const Common::FileList dlcFiles(*d); const Common::FileList moduleFiles(Common::FilePath::findSubDirectory(*d, "module", true)); const Common::UString cifFile = moduleFiles.findFirstGlob(".*\\.cif", true); const Common::UString manifestFile = dlcFiles.findFirst("/manifest.xml", true); const Common::UString addinBase = Common::FilePath::relativize(dlcDir, *d); addCampaign(readCampaign(cifFile, manifestFile, addinBase)); } }
void Campaign::findCampaigns() { Common::UString moduleDir = ConfigMan.getString("WITCHER_moduleDir"); if (moduleDir.empty()) return; Common::FileList modules; if (!modules.addDirectory(moduleDir, -1)) return; Common::FileList mmdFiles; if (!modules.getSubListGlob(".*\\.mmd", true, mmdFiles)) return; for (Common::FileList::const_iterator c = mmdFiles.begin(); c != mmdFiles.end(); ++c) { CampaignDescription desc; desc.directory = Common::FilePath::relativize(moduleDir, Common::FilePath::getDirectory(*c)); if (!readCampaign(*c, desc)) continue; _campaigns.push_back(desc); } }