本文整理汇总了C++中FileLoader::Exists方法的典型用法代码示例。如果您正苦于以下问题:C++ FileLoader::Exists方法的具体用法?C++ FileLoader::Exists怎么用?C++ FileLoader::Exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileLoader
的用法示例。
在下文中一共展示了FileLoader::Exists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Exists
bool CachingFileLoader::Exists() {
if (exists_ == -1) {
lock_guard guard(backendMutex_);
exists_ = backend_->Exists() ? 1 : 0;
}
return exists_ == 1;
}
示例2: __UmdReplace
void __UmdReplace(std::string filepath) {
// TODO: This should really go through Loaders, no? What if it's an invalid file?
// Only get system from disc0 seems have been enough.
IFileSystem* currentUMD = pspFileSystem.GetSystem("disc0:");
IFileSystem* currentISOBlock = pspFileSystem.GetSystem("umd0:");
if (!currentUMD)
return;
FileLoader *loadedFile = ConstructFileLoader(filepath);
IFileSystem* umd2;
if (!loadedFile->Exists()) {
delete loadedFile;
return;
}
UpdateLoadedFile(loadedFile);
if (loadedFile->IsDirectory()) {
umd2 = new VirtualDiscFileSystem(&pspFileSystem, filepath);
} else {
auto bd = constructBlockDevice(loadedFile);
if (!bd)
return;
umd2 = new ISOFileSystem(&pspFileSystem, bd);
pspFileSystem.Remount(currentUMD, umd2);
if (currentUMD != currentISOBlock) {
// We mounted an ISO block system separately.
IFileSystem *iso = new ISOBlockSystem(static_cast<ISOFileSystem *>(umd2));
pspFileSystem.Remount(currentISOBlock, iso);
delete currentISOBlock;
}
}
delete currentUMD;
// TODO Is this always correct if UMD was not activated?
u32 notifyArg = PSP_UMD_PRESENT | PSP_UMD_READABLE | PSP_UMD_CHANGED;
if (driveCBId != -1)
__KernelNotifyCallback(driveCBId, notifyArg);
}
示例3: AddRecent
void Config::AddRecent(const std::string &file) {
// Don't bother with this if the user disabled recents (it's -1).
if (iMaxRecent <= 0)
return;
for (auto str = recentIsos.begin(); str != recentIsos.end(); ++str) {
#ifdef _WIN32
if (!strcmpIgnore((*str).c_str(), file.c_str(), "\\", "/")) {
#else
if (!strcmp((*str).c_str(), file.c_str())) {
#endif
recentIsos.erase(str);
recentIsos.insert(recentIsos.begin(), file);
if ((int)recentIsos.size() > iMaxRecent)
recentIsos.resize(iMaxRecent);
return;
}
}
recentIsos.insert(recentIsos.begin(), file);
if ((int)recentIsos.size() > iMaxRecent)
recentIsos.resize(iMaxRecent);
}
void Config::CleanRecent() {
std::vector<std::string> cleanedRecent;
for (size_t i = 0; i < recentIsos.size(); i++) {
FileLoader *loader = ConstructFileLoader(recentIsos[i]);
if (loader->Exists()) {
// Make sure we don't have any redundant items.
auto duplicate = std::find(cleanedRecent.begin(), cleanedRecent.end(), recentIsos[i]);
if (duplicate == cleanedRecent.end()) {
cleanedRecent.push_back(recentIsos[i]);
}
}
delete loader;
}
recentIsos = cleanedRecent;
}