本文整理汇总了C++中common::FileList::addDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ FileList::addDirectory方法的具体用法?C++ FileList::addDirectory怎么用?C++ FileList::addDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::FileList
的用法示例。
在下文中一共展示了FileList::addDirectory方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: probe
bool TheWitcherEngineProbe::probe(const Common::UString &directory, const Common::FileList &rootFiles) const {
// There should be a system directory
Common::UString systemDir = Common::FilePath::findSubDirectory(directory, "system", true);
if (systemDir.empty())
return false;
// The system directory has to be readable
Common::FileList systemFiles;
if (!systemFiles.addDirectory(systemDir))
return false;
// If either witcher.ini or witcher.exe exists, this should be a valid path
return systemFiles.contains(".*/witcher.(exe|ini)", true);
}
示例2: getCharacters
void NWNEngine::getCharacters(std::vector<Common::UString> &characters, bool local) {
characters.clear();
Common::UString pcDir = ConfigMan.getString(local ? "NWN_localPCDir" : "NWN_serverPCDir");
if (pcDir.empty())
return;
Common::FileList chars;
chars.addDirectory(pcDir);
for (Common::FileList::const_iterator c = chars.begin(); c != chars.end(); ++c) {
if (!Common::FilePath::getExtension(*c).equalsIgnoreCase(".bic"))
continue;
characters.push_back(Common::FilePath::getStem(*c));
}
}
示例3: getModules
void NWNEngine::getModules(std::vector<Common::UString> &modules) {
modules.clear();
Common::UString moduleDir = ConfigMan.getString("NWN_extraModuleDir");
if (moduleDir.empty())
return;
Common::FileList mods;
mods.addDirectory(moduleDir);
for (Common::FileList::const_iterator m = mods.begin(); m != mods.end(); ++m) {
if (!Common::FilePath::getExtension(*m).equalsIgnoreCase(".mod"))
continue;
modules.push_back(Common::FilePath::getStem(*m));
}
std::sort(modules.begin(), modules.end(), Common::UString::iless());
}
示例4: addArchiveDir
void ResourceManager::addArchiveDir(ArchiveType archive, const Common::UString &dir) {
if (archive == kArchiveNDS || archive == kArchiveHERF)
return;
assert((archive >= 0) && (archive < kArchiveMAX));
Common::UString directory = Common::FilePath::findSubDirectory(_baseDir, dir, true);
if (directory.empty())
throw Common::Exception("No such directory \"%s\"", dir.c_str());
Common::FileList dirFiles;
if (!dirFiles.addDirectory(directory))
throw Common::Exception("Can't read directory \"%s\"", directory.c_str());
dirFiles.getSubList(kArchiveGlob[archive], _archiveFiles[archive], true);
// If we're adding an ERF directory and .rim files are actually ERFs, add those too
if ((archive == kArchiveERF) && _rimsAreERFs)
dirFiles.getSubList(kArchiveGlob[kArchiveRIM], _archiveFiles[archive], true);
_archiveDirs[archive].push_back(directory);
}
示例5: findCampaigns
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);
}
}
示例6: getModules
void Game::getModules(std::vector<Common::UString> &modules) {
modules.clear();
Common::UString moduleDir = ConfigMan.getString("KOTOR_moduleDir");
if (moduleDir.empty())
return;
Common::FileList mods;
mods.addDirectory(moduleDir);
for (Common::FileList::const_iterator m = mods.begin(); m != mods.end(); ++m) {
Common::UString file = m->toLower();
if (!file.endsWith("_s.rim"))
continue;
file = Common::FilePath::getStem(file);
file.truncate(file.size() - Common::UString("_s").size());
modules.push_back(file);
}
std::sort(modules.begin(), modules.end(), Common::UString::iless());
}
示例7: probe
bool GameInstanceEngine::probe() {
if (Common::FilePath::isDirectory(_target)) {
// Try to probe from that directory
Common::FileList rootFiles;
if (!rootFiles.addDirectory(_target))
// Fatal: can't read the directory
return false;
return probe(rootFiles);
}
if (Common::FilePath::isRegularFile(_target)) {
// Try to probe from that file
Common::ReadFile file;
if (file.open(_target))
return probe(file);
}
return false;
}