[Scummvm-cvs-logs] SF.net SVN: scummvm:[33586] scummvm/trunk/common
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun Aug 3 20:11:27 CEST 2008
Revision: 33586
http://scummvm.svn.sourceforge.net/scummvm/?rev=33586&view=rev
Author: fingolfin
Date: 2008-08-03 18:11:27 +0000 (Sun, 03 Aug 2008)
Log Message:
-----------
Implemented DumpFile::open(FSNode)
Modified Paths:
--------------
scummvm/trunk/common/file.cpp
scummvm/trunk/common/file.h
Modified: scummvm/trunk/common/file.cpp
===================================================================
--- scummvm/trunk/common/file.cpp 2008-08-03 17:05:01 UTC (rev 33585)
+++ scummvm/trunk/common/file.cpp 2008-08-03 18:11:27 UTC (rev 33586)
@@ -494,6 +494,31 @@
return _handle != NULL;
}
+bool DumpFile::open(const FilesystemNode &node) {
+ assert(!_handle);
+
+ if (!node.exists()) {
+ warning("File::open: Trying to open a FilesystemNode which does not exist");
+ return false;
+ } else if (node.isDirectory()) {
+ warning("File::open: Trying to open a FilesystemNode which is a directory");
+ return false;
+ } /*else if (!node.isReadable() && mode == kFileReadMode) {
+ warning("File::open: Trying to open an unreadable FilesystemNode object for reading");
+ return false;
+ } else if (!node.isWritable() && mode == kFileWriteMode) {
+ warning("File::open: Trying to open an unwritable FilesystemNode object for writing");
+ return false;
+ }*/
+
+ _handle = fopen(node.getPath().c_str(), "rb");
+
+ if (_handle == NULL)
+ debug(2, "File %s not found", node.getName().c_str());
+
+ return _handle != NULL;
+}
+
void DumpFile::close() {
if (_handle)
fclose((FILE *)_handle);
Modified: scummvm/trunk/common/file.h
===================================================================
--- scummvm/trunk/common/file.h 2008-08-03 17:05:01 UTC (rev 33585)
+++ scummvm/trunk/common/file.h 2008-08-03 18:11:27 UTC (rev 33586)
@@ -125,7 +125,7 @@
virtual ~DumpFile();
virtual bool open(const String &filename);
- //virtual bool open(const FilesystemNode &node);
+ virtual bool open(const FilesystemNode &node);
virtual void close();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list