mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-03 15:41:41 +00:00
Renamed FSNode::openForReading / openForWriting to createReadStream / createWriteStream, again to make ownership of the returned stream clear
svn-id: r36014
This commit is contained in:
parent
e4b013f616
commit
8f16458e9b
@ -52,7 +52,7 @@ protected:
|
|||||||
* When called with a name not matching any of the files/dirs contained in this
|
* When called with a name not matching any of the files/dirs contained in this
|
||||||
* directory, a valid node shold be returned, which returns 'false' upon calling
|
* directory, a valid node shold be returned, which returns 'false' upon calling
|
||||||
* the exists() method. The idea is that this node can then still can be used to
|
* the exists() method. The idea is that this node can then still can be used to
|
||||||
* create a new file via the openForWriting() method.
|
* create a new file via the createWriteStream() method.
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* Calling getChild() for a node with path "/foo/bar" using name="file.txt",
|
* Calling getChild() for a node with path "/foo/bar" using name="file.txt",
|
||||||
@ -169,7 +169,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return pointer to the stream object, 0 in case of a failure
|
* @return pointer to the stream object, 0 in case of a failure
|
||||||
*/
|
*/
|
||||||
virtual Common::SeekableReadStream *openForReading() = 0;
|
virtual Common::SeekableReadStream *createReadStream() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a WriteStream instance corresponding to the file
|
* Creates a WriteStream instance corresponding to the file
|
||||||
@ -178,7 +178,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return pointer to the stream object, 0 in case of a failure
|
* @return pointer to the stream object, 0 in case of a failure
|
||||||
*/
|
*/
|
||||||
virtual Common::WriteStream *openForWriting() = 0;
|
virtual Common::WriteStream *createWriteStream() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,8 +107,8 @@ public:
|
|||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual AbstractFSNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *createReadStream();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *createWriteStream();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a list with all the volumes present in the root node.
|
* Creates a list with all the volumes present in the root node.
|
||||||
@ -569,11 +569,11 @@ AbstractFSList AmigaOSFilesystemNode::listVolumes() const {
|
|||||||
return myList;
|
return myList;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *AmigaOSFilesystemNode::openForReading() {
|
Common::SeekableReadStream *AmigaOSFilesystemNode::createReadStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), false);
|
return StdioStream::makeFromPath(getPath().c_str(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *AmigaOSFilesystemNode::openForWriting() {
|
Common::WriteStream *AmigaOSFilesystemNode::createWriteStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), true);
|
return StdioStream::makeFromPath(getPath().c_str(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,11 +196,11 @@ AbstractFSNode* DSFileSystemNode::getParent() const {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *DSFileSystemNode::openForReading() {
|
Common::SeekableReadStream *DSFileSystemNode::createReadStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), false);
|
return StdioStream::makeFromPath(getPath().c_str(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *DSFileSystemNode::openForWriting() {
|
Common::WriteStream *DSFileSystemNode::createWriteStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), true);
|
return StdioStream::makeFromPath(getPath().c_str(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ AbstractFSNode* GBAMPFileSystemNode::getParent() const {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *GBAMPFileSystemNode::openForReading() {
|
Common::SeekableReadStream *GBAMPFileSystemNode::createReadStream() {
|
||||||
// consolePrintf("Opening: %s\n", getPath().c_str());
|
// consolePrintf("Opening: %s\n", getPath().c_str());
|
||||||
|
|
||||||
if (!strncmp(getPath().c_str(), "mp:/", 4)) {
|
if (!strncmp(getPath().c_str(), "mp:/", 4)) {
|
||||||
@ -382,7 +382,7 @@ Common::SeekableReadStream *GBAMPFileSystemNode::openForReading() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *GBAMPFileSystemNode::openForWriting() {
|
Common::WriteStream *GBAMPFileSystemNode::createWriteStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), true);
|
return StdioStream::makeFromPath(getPath().c_str(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +90,8 @@ public:
|
|||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual AbstractFSNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *createReadStream();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *createWriteStream();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the zip file this node points to.
|
* Returns the zip file this node points to.
|
||||||
@ -155,8 +155,8 @@ public:
|
|||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual AbstractFSNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *createReadStream();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *createWriteStream();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fileHandle {
|
struct fileHandle {
|
||||||
|
@ -68,8 +68,8 @@ public:
|
|||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual AbstractFSNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *createReadStream();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *createWriteStream();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
@ -208,11 +208,11 @@ AbstractFSNode *PalmOSFilesystemNode::getParent() const {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *PalmOSFilesystemNode::openForReading() {
|
Common::SeekableReadStream *PalmOSFilesystemNode::createReadStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), false);
|
return StdioStream::makeFromPath(getPath().c_str(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *PalmOSFilesystemNode::openForWriting() {
|
Common::WriteStream *PalmOSFilesystemNode::createWriteStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), true);
|
return StdioStream::makeFromPath(getPath().c_str(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,11 +237,11 @@ AbstractFSNode *POSIXFilesystemNode::getParent() const {
|
|||||||
return makeNode(Common::String(start, end));
|
return makeNode(Common::String(start, end));
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *POSIXFilesystemNode::openForReading() {
|
Common::SeekableReadStream *POSIXFilesystemNode::createReadStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), false);
|
return StdioStream::makeFromPath(getPath().c_str(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *POSIXFilesystemNode::openForWriting() {
|
Common::WriteStream *POSIXFilesystemNode::createWriteStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), true);
|
return StdioStream::makeFromPath(getPath().c_str(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@ public:
|
|||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual AbstractFSNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *createReadStream();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *createWriteStream();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -100,8 +100,8 @@ public:
|
|||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual AbstractFSNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *createReadStream();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *createWriteStream();
|
||||||
};
|
};
|
||||||
|
|
||||||
Ps2FilesystemNode::Ps2FilesystemNode() {
|
Ps2FilesystemNode::Ps2FilesystemNode() {
|
||||||
@ -341,10 +341,10 @@ char *Ps2FilesystemNode::getDeviceDescription(const char *path) const {
|
|||||||
return "Harddisk";
|
return "Harddisk";
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *Ps2FilesystemNode::openForReading() {
|
Common::SeekableReadStream *Ps2FilesystemNode::createReadStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), false);
|
return StdioStream::makeFromPath(getPath().c_str(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *Ps2FilesystemNode::openForWriting() {
|
Common::WriteStream *Ps2FilesystemNode::createWriteStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), true);
|
return StdioStream::makeFromPath(getPath().c_str(), true);
|
||||||
}
|
}
|
||||||
|
@ -71,8 +71,8 @@ public:
|
|||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual AbstractFSNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *createReadStream();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *createWriteStream();
|
||||||
};
|
};
|
||||||
|
|
||||||
PSPFilesystemNode::PSPFilesystemNode() {
|
PSPFilesystemNode::PSPFilesystemNode() {
|
||||||
@ -161,11 +161,11 @@ AbstractFSNode *PSPFilesystemNode::getParent() const {
|
|||||||
return new PSPFilesystemNode(Common::String(start, end - start), false);
|
return new PSPFilesystemNode(Common::String(start, end - start), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *PSPFilesystemNode::openForReading() {
|
Common::SeekableReadStream *PSPFilesystemNode::createReadStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), false);
|
return StdioStream::makeFromPath(getPath().c_str(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *PSPFilesystemNode::openForWriting() {
|
Common::WriteStream *PSPFilesystemNode::createWriteStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), true);
|
return StdioStream::makeFromPath(getPath().c_str(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,8 +79,8 @@ public:
|
|||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual AbstractFSNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *createReadStream();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *createWriteStream();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -252,11 +252,11 @@ AbstractFSNode *SymbianFilesystemNode::getParent() const {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *SymbianFilesystemNode::openForReading() {
|
Common::SeekableReadStream *SymbianFilesystemNode::createReadStream() {
|
||||||
return SymbianStdioStream::makeFromPath(getPath().c_str(), false);
|
return SymbianStdioStream::makeFromPath(getPath().c_str(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *SymbianFilesystemNode::openForWriting() {
|
Common::WriteStream *SymbianFilesystemNode::createWriteStream() {
|
||||||
return SymbianStdioStream::makeFromPath(getPath().c_str(), true);
|
return SymbianStdioStream::makeFromPath(getPath().c_str(), true);
|
||||||
}
|
}
|
||||||
#endif //#if defined (__SYMBIAN32__)
|
#endif //#if defined (__SYMBIAN32__)
|
||||||
|
@ -79,8 +79,8 @@ public:
|
|||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual AbstractFSNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *createReadStream();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *createWriteStream();
|
||||||
|
|
||||||
static void asyncHandler(bool umount, const Common::String *path);
|
static void asyncHandler(bool umount, const Common::String *path);
|
||||||
};
|
};
|
||||||
@ -290,11 +290,11 @@ AbstractFSNode *WiiFilesystemNode::getParent() const {
|
|||||||
return new WiiFilesystemNode(Common::String(start, end - start));
|
return new WiiFilesystemNode(Common::String(start, end - start));
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *WiiFilesystemNode::openForReading() {
|
Common::SeekableReadStream *WiiFilesystemNode::createReadStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), false);
|
return StdioStream::makeFromPath(getPath().c_str(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *WiiFilesystemNode::openForWriting() {
|
Common::WriteStream *WiiFilesystemNode::createWriteStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), true);
|
return StdioStream::makeFromPath(getPath().c_str(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,8 +102,8 @@ public:
|
|||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual AbstractFSNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *createReadStream();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *createWriteStream();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
@ -313,11 +313,11 @@ AbstractFSNode *WindowsFilesystemNode::getParent() const {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *WindowsFilesystemNode::openForReading() {
|
Common::SeekableReadStream *WindowsFilesystemNode::createReadStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), false);
|
return StdioStream::makeFromPath(getPath().c_str(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *WindowsFilesystemNode::openForWriting() {
|
Common::WriteStream *WindowsFilesystemNode::createWriteStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), true);
|
return StdioStream::makeFromPath(getPath().c_str(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,10 +183,10 @@ Common::TimerManager *OSystem_PalmBase::getTimerManager() {
|
|||||||
|
|
||||||
Common::SeekableReadStream *OSystem_PalmBase::createConfigReadStream() {
|
Common::SeekableReadStream *OSystem_PalmBase::createConfigReadStream() {
|
||||||
Common::FSNode file(PALMOS_CONFIG_FILE);
|
Common::FSNode file(PALMOS_CONFIG_FILE);
|
||||||
return file.openForReading();
|
return file.createReadStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *OSystem_PalmBase::createConfigWriteStream() {
|
Common::WriteStream *OSystem_PalmBase::createConfigWriteStream() {
|
||||||
Common::FSNode file(PALMOS_CONFIG_FILE);
|
Common::FSNode file(PALMOS_CONFIG_FILE);
|
||||||
return file.openForWriting();
|
return file.createWriteStream();
|
||||||
}
|
}
|
||||||
|
@ -53,8 +53,8 @@ public:
|
|||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const { return false; }
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const { return false; }
|
||||||
virtual AbstractFSNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *createReadStream();
|
||||||
virtual Common::WriteStream *openForWriting() { return 0; }
|
virtual Common::WriteStream *createWriteStream() { return 0; }
|
||||||
|
|
||||||
static AbstractFSNode *makeFileNodePath(const Common::String &path);
|
static AbstractFSNode *makeFileNodePath(const Common::String &path);
|
||||||
};
|
};
|
||||||
@ -67,7 +67,7 @@ public:
|
|||||||
virtual bool isDirectory() const { return true; }
|
virtual bool isDirectory() const { return true; }
|
||||||
virtual AbstractFSNode *getChild(const Common::String &n) const;
|
virtual AbstractFSNode *getChild(const Common::String &n) const;
|
||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual Common::SeekableReadStream *openForReading() { return 0; }
|
virtual Common::SeekableReadStream *createReadStream() { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A file/directory which does not exist */
|
/* A file/directory which does not exist */
|
||||||
@ -77,7 +77,7 @@ public:
|
|||||||
|
|
||||||
virtual bool exists() const { return false; }
|
virtual bool exists() const { return false; }
|
||||||
virtual bool isReadable() const { return false; }
|
virtual bool isReadable() const { return false; }
|
||||||
virtual Common::SeekableReadStream *openForReading() { return 0; }
|
virtual Common::SeekableReadStream *createReadStream() { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
AbstractFSNode *RoninCDFileNode::makeFileNodePath(const Common::String &path) {
|
AbstractFSNode *RoninCDFileNode::makeFileNodePath(const Common::String &path) {
|
||||||
@ -150,7 +150,7 @@ AbstractFSNode *RoninCDFileNode::getParent() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Common::SeekableReadStream *RoninCDFileNode::openForReading() {
|
Common::SeekableReadStream *RoninCDFileNode::createReadStream() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), false);
|
return StdioStream::makeFromPath(getPath().c_str(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1314,12 +1314,12 @@ OSystem *OSystem_IPHONE_create() {
|
|||||||
|
|
||||||
Common::SeekableReadStream *OSystem_IPHONE::createConfigReadStream() {
|
Common::SeekableReadStream *OSystem_IPHONE::createConfigReadStream() {
|
||||||
Common::FSNode file(SCUMMVM_PREFS_PATH);
|
Common::FSNode file(SCUMMVM_PREFS_PATH);
|
||||||
return file.openForReading();
|
return file.createReadStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *OSystem_IPHONE::createConfigWriteStream() {
|
Common::WriteStream *OSystem_IPHONE::createConfigWriteStream() {
|
||||||
Common::FSNode file(SCUMMVM_PREFS_PATH);
|
Common::FSNode file(SCUMMVM_PREFS_PATH);
|
||||||
return file.openForWriting();
|
return file.createWriteStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
void iphone_main(int argc, char *argv[]) {
|
void iphone_main(int argc, char *argv[]) {
|
||||||
|
@ -776,14 +776,14 @@ Common::SeekableReadStream *OSystem_PS2::createConfigReadStream() {
|
|||||||
char configFile[MAXPATHLEN];
|
char configFile[MAXPATHLEN];
|
||||||
makeConfigPath(configFile);
|
makeConfigPath(configFile);
|
||||||
Common::FSNode file(configFile);
|
Common::FSNode file(configFile);
|
||||||
return file.openForReading();
|
return file.createReadStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *OSystem_PS2::createConfigWriteStream() {
|
Common::WriteStream *OSystem_PS2::createConfigWriteStream() {
|
||||||
char configFile[MAXPATHLEN];
|
char configFile[MAXPATHLEN];
|
||||||
makeConfigPath(configFile);
|
makeConfigPath(configFile);
|
||||||
Common::FSNode file(configFile);
|
Common::FSNode file(configFile);
|
||||||
return file.openForWriting();
|
return file.createWriteStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OSystem_PS2::runningFromHost(void) {
|
bool OSystem_PS2::runningFromHost(void) {
|
||||||
|
@ -645,10 +645,10 @@ void OSystem_PSP::displayMessageOnOSD(const char *msg) {
|
|||||||
|
|
||||||
Common::SeekableReadStream *OSystem_PSP::createConfigReadStream() {
|
Common::SeekableReadStream *OSystem_PSP::createConfigReadStream() {
|
||||||
Common::FSNode file(PSP_CONFIG_FILE);
|
Common::FSNode file(PSP_CONFIG_FILE);
|
||||||
return file.openForReading();
|
return file.createReadStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *OSystem_PSP::createConfigWriteStream() {
|
Common::WriteStream *OSystem_PSP::createConfigWriteStream() {
|
||||||
Common::FSNode file(PSP_CONFIG_FILE);
|
Common::FSNode file(PSP_CONFIG_FILE);
|
||||||
return file.openForWriting();
|
return file.createWriteStream();
|
||||||
}
|
}
|
||||||
|
@ -386,12 +386,12 @@ static Common::String getDefaultConfigFileName() {
|
|||||||
|
|
||||||
Common::SeekableReadStream *OSystem_SDL::createConfigReadStream() {
|
Common::SeekableReadStream *OSystem_SDL::createConfigReadStream() {
|
||||||
Common::FSNode file(getDefaultConfigFileName());
|
Common::FSNode file(getDefaultConfigFileName());
|
||||||
return file.openForReading();
|
return file.createReadStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *OSystem_SDL::createConfigWriteStream() {
|
Common::WriteStream *OSystem_SDL::createConfigWriteStream() {
|
||||||
Common::FSNode file(getDefaultConfigFileName());
|
Common::FSNode file(getDefaultConfigFileName());
|
||||||
return file.openForWriting();
|
return file.createWriteStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_SDL::setWindowCaption(const char *caption) {
|
void OSystem_SDL::setWindowCaption(const char *caption) {
|
||||||
|
@ -125,12 +125,12 @@ static Common::String getDefaultConfigFileName() {
|
|||||||
|
|
||||||
Common::SeekableReadStream *OSystem_SDL_Symbian::createConfigReadStream() {
|
Common::SeekableReadStream *OSystem_SDL_Symbian::createConfigReadStream() {
|
||||||
Common::FSNode file(getDefaultConfigFileName());
|
Common::FSNode file(getDefaultConfigFileName());
|
||||||
return file.openForReading();
|
return file.createReadStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *OSystem_SDL_Symbian::createConfigWriteStream() {
|
Common::WriteStream *OSystem_SDL_Symbian::createConfigWriteStream() {
|
||||||
Common::FSNode file(getDefaultConfigFileName());
|
Common::FSNode file(getDefaultConfigFileName());
|
||||||
return file.openForWriting();
|
return file.createWriteStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
OSystem_SDL_Symbian::zoneDesc OSystem_SDL_Symbian::_zones[TOTAL_ZONES] = {
|
OSystem_SDL_Symbian::zoneDesc OSystem_SDL_Symbian::_zones[TOTAL_ZONES] = {
|
||||||
|
@ -465,12 +465,12 @@ static Common::String getDefaultConfigFileName() {
|
|||||||
|
|
||||||
Common::SeekableReadStream *OSystem_WINCE3::createConfigReadStream() {
|
Common::SeekableReadStream *OSystem_WINCE3::createConfigReadStream() {
|
||||||
Common::FSNode file(getDefaultConfigFileName());
|
Common::FSNode file(getDefaultConfigFileName());
|
||||||
return file.openForReading();
|
return file.createReadStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *OSystem_WINCE3::createConfigWriteStream() {
|
Common::WriteStream *OSystem_WINCE3::createConfigWriteStream() {
|
||||||
Common::FSNode file(getDefaultConfigFileName());
|
Common::FSNode file(getDefaultConfigFileName());
|
||||||
return file.openForWriting();
|
return file.createWriteStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ********************************************************************************************
|
// ********************************************************************************************
|
||||||
|
@ -84,7 +84,7 @@ Common::InSaveFile *DefaultSaveFileManager::openForLoading(const char *filename)
|
|||||||
Common::FSNode file = savePath.getChild(filename);
|
Common::FSNode file = savePath.getChild(filename);
|
||||||
|
|
||||||
// Open the file for reading
|
// Open the file for reading
|
||||||
Common::SeekableReadStream *sf = file.openForReading();
|
Common::SeekableReadStream *sf = file.createReadStream();
|
||||||
|
|
||||||
return Common::wrapCompressedReadStream(sf);
|
return Common::wrapCompressedReadStream(sf);
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const char *filename)
|
|||||||
Common::FSNode file = savePath.getChild(filename);
|
Common::FSNode file = savePath.getChild(filename);
|
||||||
|
|
||||||
// Open the file for saving
|
// Open the file for saving
|
||||||
Common::WriteStream *sf = file.openForWriting();
|
Common::WriteStream *sf = file.createWriteStream();
|
||||||
|
|
||||||
return Common::wrapCompressedWriteStream(sf);
|
return Common::wrapCompressedWriteStream(sf);
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ SeekableReadStream *FSDirectory::openFile(const String &name) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SeekableReadStream *stream = node.openForReading();
|
SeekableReadStream *stream = node.createReadStream();
|
||||||
if (!stream)
|
if (!stream)
|
||||||
warning("FSDirectory::openFile: Can't create stream for file '%s'", name.c_str());
|
warning("FSDirectory::openFile: Can't create stream for file '%s'", name.c_str());
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ bool File::open(const FSNode &node) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SeekableReadStream *stream = node.openForReading();
|
SeekableReadStream *stream = node.createReadStream();
|
||||||
return open(stream, node.getPath());
|
return open(stream, node.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ bool DumpFile::open(const FSNode &node) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_handle = node.openForWriting();
|
_handle = node.createWriteStream();
|
||||||
|
|
||||||
if (_handle == NULL)
|
if (_handle == NULL)
|
||||||
debug(2, "File %s not found", node.getName().c_str());
|
debug(2, "File %s not found", node.getName().c_str());
|
||||||
|
@ -135,31 +135,31 @@ bool FSNode::isWritable() const {
|
|||||||
return _realNode->isWritable();
|
return _realNode->isWritable();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *FSNode::openForReading() const {
|
Common::SeekableReadStream *FSNode::createReadStream() const {
|
||||||
if (_realNode == 0)
|
if (_realNode == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!_realNode->exists()) {
|
if (!_realNode->exists()) {
|
||||||
warning("FSNode::openForReading: FSNode does not exist");
|
warning("FSNode::createReadStream: FSNode does not exist");
|
||||||
return false;
|
return false;
|
||||||
} else if (_realNode->isDirectory()) {
|
} else if (_realNode->isDirectory()) {
|
||||||
warning("FSNode::openForReading: FSNode is a directory");
|
warning("FSNode::createReadStream: FSNode is a directory");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _realNode->openForReading();
|
return _realNode->createReadStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *FSNode::openForWriting() const {
|
Common::WriteStream *FSNode::createWriteStream() const {
|
||||||
if (_realNode == 0)
|
if (_realNode == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (_realNode->isDirectory()) {
|
if (_realNode->isDirectory()) {
|
||||||
warning("FSNode::openForWriting: FSNode is a directory");
|
warning("FSNode::createWriteStream: FSNode is a directory");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _realNode->openForWriting();
|
return _realNode->createWriteStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace Common
|
} // End of namespace Common
|
||||||
|
10
common/fs.h
10
common/fs.h
@ -109,9 +109,9 @@ public:
|
|||||||
* If a child matching the name exists, a normal node for it is returned.
|
* If a child matching the name exists, a normal node for it is returned.
|
||||||
* If no child with the name exists, a node for it is still returned,
|
* If no child with the name exists, a node for it is still returned,
|
||||||
* but exists() will return 'false' for it. This node can however be used
|
* but exists() will return 'false' for it. This node can however be used
|
||||||
* to create a new file using the openForWriting() method.
|
* to create a new file using the createWriteStream() method.
|
||||||
*
|
*
|
||||||
* @todo If openForWriting() (or a hypothetical future mkdir() method) is used,
|
* @todo If createWriteStream() (or a hypothetical future mkdir() method) is used,
|
||||||
* this should affect what exists/isDirectory/isReadable/isWritable return
|
* this should affect what exists/isDirectory/isReadable/isWritable return
|
||||||
* for existing nodes. However, this is not the case for many existing
|
* for existing nodes. However, this is not the case for many existing
|
||||||
* FSNode implementations. Either fix those, or document that FSNodes
|
* FSNode implementations. Either fix those, or document that FSNodes
|
||||||
@ -213,7 +213,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return pointer to the stream object, 0 in case of a failure
|
* @return pointer to the stream object, 0 in case of a failure
|
||||||
*/
|
*/
|
||||||
virtual SeekableReadStream *openForReading() const;
|
virtual SeekableReadStream *createReadStream() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a WriteStream instance corresponding to the file
|
* Creates a WriteStream instance corresponding to the file
|
||||||
@ -222,11 +222,11 @@ public:
|
|||||||
*
|
*
|
||||||
* @return pointer to the stream object, 0 in case of a failure
|
* @return pointer to the stream object, 0 in case of a failure
|
||||||
*/
|
*/
|
||||||
virtual WriteStream *openForWriting() const;
|
virtual WriteStream *createWriteStream() const;
|
||||||
|
|
||||||
// Compatibility with ArchiveMember API.
|
// Compatibility with ArchiveMember API.
|
||||||
SeekableReadStream *open() {
|
SeekableReadStream *open() {
|
||||||
return openForReading();
|
return createReadStream();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ bool md5_file(const FSNode &file, uint8 digest[16], uint32 length) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReadStream *stream = file.openForReading();
|
ReadStream *stream = file.createReadStream();
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
warning("md5_file: failed to open '%s'", file.getPath().c_str());
|
warning("md5_file: failed to open '%s'", file.getPath().c_str());
|
||||||
return false;
|
return false;
|
||||||
|
@ -116,7 +116,7 @@ void OSystem::clearScreen() {
|
|||||||
|
|
||||||
Common::SeekableReadStream *OSystem::createConfigReadStream() {
|
Common::SeekableReadStream *OSystem::createConfigReadStream() {
|
||||||
Common::FSNode file(DEFAULT_CONFIG_FILE);
|
Common::FSNode file(DEFAULT_CONFIG_FILE);
|
||||||
return file.openForReading();
|
return file.createReadStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *OSystem::createConfigWriteStream() {
|
Common::WriteStream *OSystem::createConfigWriteStream() {
|
||||||
@ -124,6 +124,6 @@ Common::WriteStream *OSystem::createConfigWriteStream() {
|
|||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
Common::FSNode file(DEFAULT_CONFIG_FILE);
|
Common::FSNode file(DEFAULT_CONFIG_FILE);
|
||||||
return file.openForWriting();
|
return file.createWriteStream();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1381,7 +1381,7 @@ ZipArchive::ZipArchive(const Common::String &name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ZipArchive::ZipArchive(const Common::FSNode &node) {
|
ZipArchive::ZipArchive(const Common::FSNode &node) {
|
||||||
SeekableReadStream *stream = node.openForReading();
|
SeekableReadStream *stream = node.createReadStream();
|
||||||
_zipFile = unzOpen(stream);
|
_zipFile = unzOpen(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ bool XMLParser::loadFile(const Common::String &filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool XMLParser::loadFile(const FSNode &node) {
|
bool XMLParser::loadFile(const FSNode &node) {
|
||||||
_stream = node.openForReading();
|
_stream = node.createReadStream();
|
||||||
if (!_stream)
|
if (!_stream)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ bool WagFileParser::parse(const Common::FSNode &node) {
|
|||||||
|
|
||||||
_parsedOk = false; // We haven't parsed the file yet
|
_parsedOk = false; // We haven't parsed the file yet
|
||||||
|
|
||||||
stream = node.openForReading(); // Open the file
|
stream = node.createReadStream(); // Open the file
|
||||||
if (stream) { // Check that opening the file was succesful
|
if (stream) { // Check that opening the file was succesful
|
||||||
if (checkWagVersion(*stream)) { // Check that WinAGI version string is valid
|
if (checkWagVersion(*stream)) { // Check that WinAGI version string is valid
|
||||||
// It seems we've got a valid *.wag file so let's parse its properties from the start.
|
// It seems we've got a valid *.wag file so let's parse its properties from the start.
|
||||||
|
Loading…
Reference in New Issue
Block a user