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


C++ FSNode::createWriteStream方法代码示例

本文整理汇总了C++中common::FSNode::createWriteStream方法的典型用法代码示例。如果您正苦于以下问题:C++ FSNode::createWriteStream方法的具体用法?C++ FSNode::createWriteStream怎么用?C++ FSNode::createWriteStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common::FSNode的用法示例。


在下文中一共展示了FSNode::createWriteStream方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gameRoot

Common::WriteStream *TestbedConfigManager::getConfigWriteStream() const {
	// Look for config file in game-path
	const Common::String &path = ConfMan.get("path");
	Common::WriteStream *ws;
	Common::FSNode gameRoot(path);
	Common::FSNode config = gameRoot.getChild(_configFileName);
	ws = config.createWriteStream();
	return ws;
}
开发者ID:MaddTheSane,项目名称:scummvm,代码行数:9,代码来源:config.cpp

示例2: savePath

Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const Common::String &filename, bool compress) {
	Common::FSNode savePath(ConfMan.get("savepath")); // TODO: is this fast?
	Common::WriteStream *sf;

	printf("openForSaving : %s\n", filename.c_str());

	if (!savePath.exists() || !savePath.isDirectory())
		return NULL;

	_screen->wantAnim(true);

	if (_getDev(savePath) == MC_DEV) {
	// if (strncmp(savePath.getPath().c_str(), "mc0:", 4) == 0) {
		char path[32];

		// FIXME : hack for indy4 iq-points
		if (filename == "iq-points") {
			mcCheck("mc0:ScummVM/indy4");
			sprintf(path, "mc0:ScummVM/indy4/iq-points");
		}
		// FIXME : hack for bs1 saved games
        else if (filename == "SAVEGAME.INF") {
            mcCheck("mc0:ScummVM/sword1");
            sprintf(path, "mc0:ScummVM/sword1/SAVEGAME.INF");
        }
		else {
			char temp[32];
			strcpy(temp, filename.c_str());

			// mcSplit(temp, game, ext);
			char *game = strdup(strtok(temp, "."));
			char *ext = strdup(strtok(NULL, "*"));
			sprintf(path, "mc0:ScummVM/%s", game); // per game path
			mcCheck(path);
			sprintf(path, "mc0:ScummVM/%s/%s.sav", game, ext);

			free(game);
			free(ext);
		}

		Common::FSNode file(path);
		sf = file.createWriteStream();
	} else {
		Common::FSNode file = savePath.getChild(filename);
		sf = file.createWriteStream();
	}

	_screen->wantAnim(false);
	return compress ? Common::wrapCompressedWriteStream(sf) : sf;
}
开发者ID:33d,项目名称:scummvm,代码行数:50,代码来源:savefilemgr.cpp

示例3: savePath

Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String &filename, bool compress) {
	// Ensure that the savepath is valid. If not, generate an appropriate error.
	Common::String savePathName = getSavePath();
	checkPath(Common::FSNode(savePathName));
	if (getError().getCode() != Common::kNoError)
		return 0;

	// recreate FSNode since checkPath may have changed/created the directory
	Common::FSNode savePath(savePathName);

	Common::FSNode file = savePath.getChild(filename);

	// Open the file for saving
	Common::WriteStream *sf = file.createWriteStream();

	return compress ? Common::wrapCompressedWriteStream(sf) : sf;
}
开发者ID:0xf1sh,项目名称:scummvm,代码行数:17,代码来源:default-saves.cpp

示例4: getSavePath

Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String &filename, bool compress) {
	// Assure the savefile name cache is up-to-date.
	const Common::String savePathName = getSavePath();
	assureCached(savePathName);
	if (getError().getCode() != Common::kNoError)
		return nullptr;

	for (Common::StringArray::const_iterator i = _lockedFiles.begin(), end = _lockedFiles.end(); i != end; ++i) {
		if (filename == *i) {
			return nullptr; //file is locked, no saving available
		}
	}

#ifdef USE_LIBCURL
	// Update file's timestamp
	Common::HashMap<Common::String, uint32> timestamps = loadTimestamps();
	timestamps[filename] = INVALID_TIMESTAMP;
	saveTimestamps(timestamps);
#endif

	// Obtain node.
	SaveFileCache::const_iterator file = _saveFileCache.find(filename);
	Common::FSNode fileNode;

	// If the file did not exist before, we add it to the cache.
	if (file == _saveFileCache.end()) {
		const Common::FSNode savePath(savePathName);
		fileNode = savePath.getChild(filename);
	} else {
		fileNode = file->_value;
	}

	// Open the file for saving.
	Common::WriteStream *const sf = fileNode.createWriteStream();
	Common::OutSaveFile *const result = new Common::OutSaveFile(compress ? Common::wrapCompressedWriteStream(sf) : sf);

	// Add file to cache now that it exists.
	_saveFileCache[filename] = Common::FSNode(fileNode.getPath());

	return result;
}
开发者ID:peterkohaut,项目名称:scummvm,代码行数:41,代码来源:default-saves.cpp


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