当前位置: 首页>>代码示例>>C++>>正文


C++ FileLoader::Exists方法代码示例

本文整理汇总了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;
}
开发者ID:Bigpet,项目名称:ppsspp,代码行数:7,代码来源:Loaders.cpp

示例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);
}
开发者ID:AdmiralCurtiss,项目名称:ppsspp,代码行数:41,代码来源:sceUmd.cpp

示例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;
}
开发者ID:Roceso1337,项目名称:ppsspp,代码行数:38,代码来源:Config.cpp


注:本文中的FileLoader::Exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。