Logo Search packages:      
Sourcecode: scummvm version File versions  Download package

Common::OutSaveFile * DefaultSaveFileManager::openForSaving ( const Common::String name  )  [virtual, inherited]

Open the savefile with the specified name in the given directory for saving.

Parameters:
name the name of the savefile
Returns:
pointer to an OutSaveFile, or NULL if an error occured.

Implements Common::SaveFileManager.

Definition at line 100 of file default-saves.cpp.

References DefaultSaveFileManager::checkPath(), Common::FSNode::createWriteStream(), Common::FSNode::getChild(), Common::SaveFileManager::getError(), DefaultSaveFileManager::getSavePath(), Common::kNoError, and Common::wrapCompressedWriteStream().

                                                                                     {
      // Ensure that the savepath is valid. If not, generate an appropriate error.
      Common::String savePathName = getSavePath();
      checkPath(Common::FSNode(savePathName));
      if (getError() != 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 Common::wrapCompressedWriteStream(sf);
}


Generated by  Doxygen 1.6.0   Back to index