diff options
author | Max Horn | 2002-11-14 15:02:26 +0000 |
---|---|---|
committer | Max Horn | 2002-11-14 15:02:26 +0000 |
commit | 637ffcc517fa11a3fb96e95832c7949ef20fe355 (patch) | |
tree | 0d2853ab4989ee691b009e8d5d3964b1e1a7f0ce | |
parent | 981cad2d0ed69666b31f423bd678aaa43521acf7 (diff) | |
download | scummvm-rg350-637ffcc517fa11a3fb96e95832c7949ef20fe355.tar.gz scummvm-rg350-637ffcc517fa11a3fb96e95832c7949ef20fe355.tar.bz2 scummvm-rg350-637ffcc517fa11a3fb96e95832c7949ef20fe355.zip |
added dummy FS backend for Windows; somebody has to implement the actual code for it. Also, we probably want something like this for MorphOS; and maybe also a 'null' dummy implementation?
svn-id: r5553
-rw-r--r-- | Makefile.common | 3 | ||||
-rw-r--r-- | backends/fs/windows/windows-fs.cpp | 97 |
2 files changed, 99 insertions, 1 deletions
diff --git a/Makefile.common b/Makefile.common index 4309cdcca9..5daa301900 100644 --- a/Makefile.common +++ b/Makefile.common @@ -10,7 +10,8 @@ ZIPFILE := scummvm-`date '+%Y-%m-%d'`.zip INCS = scumm/scumm.h common/scummsys.h common/stdafx.h BACKEND_OBJS = \ - backends/fs/posix/posix-fs.o + backends/fs/posix/posix-fs.o \ + backends/fs/windows/windows-fs.o COMMON_OBJS = \ common/config-file.o \ diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp new file mode 100644 index 0000000000..bd89f6438d --- /dev/null +++ b/backends/fs/windows/windows-fs.cpp @@ -0,0 +1,97 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + */ + +// TODO - how about we #define WINDOWS for all our windows targets? +#if defined(_MSC_VER) || defined(__MINGW32__) + +#include "../fs.h" + + +// TODO - this file is just a dummy place holder for the person who wants to implement +// the FS backend for windows. I don't even gurantee it compiles, but it should as a +// starting place for the implementor at least. +// Look at posix-fs.cpp to see how it is done there, at fs.h for documentation of the +// API. I know that Exult as in files/listfiles.cc implementations for something similar +// for at least Unix, Windows, BeOS, MorphOS and MacOS, if you want to see how it is done. + + +/* + * Implementation of the ScummVM file system API based on Windows API. + */ + +class WindowsFilesystemNode : public FilesystemNode { +protected: + // TODO - decide what members to offer. The following are used in the POSIX + // implementations, but feel free to scrap all of them and use a complete + // different inner working scheme + String _displayName; + bool _isDirectory; + bool _isValid; + String _path; + +public: + WindowsFilesystemNode(); + WindowsFilesystemNode(const String &path); + WindowsFilesystemNode(const WindowsFilesystemNode *node); + + virtual String displayName() const { return _displayName; } + virtual bool isValid() const { return _isValid; } + virtual bool isDirectory() const { return _isDirectory; } + virtual String path() const { return _path; } + + virtual FSList *listDir() const; + virtual FilesystemNode *parent() const; + virtual FilesystemNode *clone() const { return new WindowsFilesystemNode(this); } +}; + + +FilesystemNode *FilesystemNode::getRoot() { + // TODO - return a node with the "root". I guess this will be a fake + // dummy node in which you insert elements for all the drives (C:, D:, ...) + return new WindowsFilesystemNode(); +} + +WindowsFilesystemNode::WindowsFilesystemNode() { + // TODO - default constructor; in the POSIX implementations this just + // produces the root node, but use as you like.... +} + +WindowsFilesystemNode::WindowsFilesystemNode(const WindowsFilesystemNode *node) { + // TODO - copy constructor +} + +FSList *WindowsFilesystemNode::listDir() const { + assert(_isDirectory); + + struct dirent *dp; + FSList *myList = new FSList(); + + // TODO - fill myList here + + return myList; +} + +FilesystemNode *WindowsFilesystemNode::parent() const { + // TODO - return a node representing the parent node of this one. + // For the root node, you may return 'this'. + return 0; +} + +#endif // defined(UNIX) |