本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}