aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2008-08-03 18:11:27 +0000
committerMax Horn2008-08-03 18:11:27 +0000
commitfe9323ae578eab9dd9f76457add2f63deefbf21d (patch)
treeb75db3d1c6f349f1e40bb07b2f7ca37a4973fe79
parentb54a1227d9bb53135e434ba9e00ce6cba592f6b1 (diff)
downloadscummvm-rg350-fe9323ae578eab9dd9f76457add2f63deefbf21d.tar.gz
scummvm-rg350-fe9323ae578eab9dd9f76457add2f63deefbf21d.tar.bz2
scummvm-rg350-fe9323ae578eab9dd9f76457add2f63deefbf21d.zip
Implemented DumpFile::open(FSNode)
svn-id: r33586
-rw-r--r--common/file.cpp25
-rw-r--r--common/file.h2
2 files changed, 26 insertions, 1 deletions
diff --git a/common/file.cpp b/common/file.cpp
index 5b465b5e01..e84e337d2f 100644
--- a/common/file.cpp
+++ b/common/file.cpp
@@ -494,6 +494,31 @@ bool DumpFile::open(const String &filename) {
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);
diff --git a/common/file.h b/common/file.h
index 3c2520b07c..54168ffc7d 100644
--- a/common/file.h
+++ b/common/file.h
@@ -125,7 +125,7 @@ public:
virtual ~DumpFile();
virtual bool open(const String &filename);
- //virtual bool open(const FilesystemNode &node);
+ virtual bool open(const FilesystemNode &node);
virtual void close();