Renamed FilesystemNode -> FSNode
svn-id: r34716
This commit is contained in:
parent
31be8a6b3f
commit
c7fde102e3
87 changed files with 435 additions and 434 deletions
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#include "backends/fs/abstract-fs.h"
|
#include "backends/fs/abstract-fs.h"
|
||||||
|
|
||||||
const char *AbstractFilesystemNode::lastPathComponent(const Common::String &str, const char sep) {
|
const char *AbstractFSNode::lastPathComponent(const Common::String &str, const char sep) {
|
||||||
// TODO: Get rid of this eventually! Use Common::lastPathComponent instead
|
// TODO: Get rid of this eventually! Use Common::lastPathComponent instead
|
||||||
if(str.empty())
|
if(str.empty())
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -29,22 +29,22 @@
|
||||||
#include "common/str.h"
|
#include "common/str.h"
|
||||||
#include "common/fs.h"
|
#include "common/fs.h"
|
||||||
|
|
||||||
class AbstractFilesystemNode;
|
class AbstractFSNode;
|
||||||
|
|
||||||
typedef Common::Array<AbstractFilesystemNode *> AbstractFSList;
|
typedef Common::Array<AbstractFSNode *> AbstractFSList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract file system node. Private subclasses implement the actual
|
* Abstract file system node. Private subclasses implement the actual
|
||||||
* functionality.
|
* functionality.
|
||||||
*
|
*
|
||||||
* Most of the methods correspond directly to methods in class FilesystemNode,
|
* Most of the methods correspond directly to methods in class FSNode,
|
||||||
* so if they are not documented here, look there for more information about
|
* so if they are not documented here, look there for more information about
|
||||||
* the semantics.
|
* the semantics.
|
||||||
*/
|
*/
|
||||||
class AbstractFilesystemNode {
|
class AbstractFSNode {
|
||||||
protected:
|
protected:
|
||||||
friend class Common::FilesystemNode;
|
friend class Common::FSNode;
|
||||||
typedef Common::FilesystemNode::ListMode ListMode;
|
typedef Common::FSNode::ListMode ListMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the child node with the given name. When called on a non-directory
|
* Returns the child node with the given name. When called on a non-directory
|
||||||
|
@ -63,13 +63,13 @@ protected:
|
||||||
*
|
*
|
||||||
* @param name String containing the name of the child to create a new node.
|
* @param name String containing the name of the child to create a new node.
|
||||||
*/
|
*/
|
||||||
virtual AbstractFilesystemNode *getChild(const Common::String &name) const = 0;
|
virtual AbstractFSNode *getChild(const Common::String &name) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The parent node of this directory.
|
* The parent node of this directory.
|
||||||
* The parent of the root is the root itself.
|
* The parent of the root is the root itself.
|
||||||
*/
|
*/
|
||||||
virtual AbstractFilesystemNode *getParent() const = 0;
|
virtual AbstractFSNode *getParent() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last component of a given path.
|
* Returns the last component of a given path.
|
||||||
|
@ -88,7 +88,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
virtual ~AbstractFilesystemNode() {}
|
virtual ~AbstractFSNode() {}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Indicates whether the object referred by this path exists in the filesystem or not.
|
* Indicates whether the object referred by this path exists in the filesystem or not.
|
||||||
|
@ -115,7 +115,7 @@ public:
|
||||||
virtual Common::String getDisplayName() const { return getName(); }
|
virtual Common::String getDisplayName() const { return getName(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last component of the path pointed by this FilesystemNode.
|
* Returns the last component of the path pointed by this FSNode.
|
||||||
*
|
*
|
||||||
* Examples (POSIX):
|
* Examples (POSIX):
|
||||||
* /foo/bar.txt would return /bar.txt
|
* /foo/bar.txt would return /bar.txt
|
||||||
|
|
|
@ -26,15 +26,15 @@
|
||||||
#include "backends/fs/amigaos4/amigaos4-fs-factory.h"
|
#include "backends/fs/amigaos4/amigaos4-fs-factory.h"
|
||||||
#include "backends/fs/amigaos4/amigaos4-fs.cpp"
|
#include "backends/fs/amigaos4/amigaos4-fs.cpp"
|
||||||
|
|
||||||
AbstractFilesystemNode *AmigaOSFilesystemFactory::makeRootFileNode() const {
|
AbstractFSNode *AmigaOSFilesystemFactory::makeRootFileNode() const {
|
||||||
return new AmigaOSFilesystemNode();
|
return new AmigaOSFilesystemNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *AmigaOSFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
AbstractFSNode *AmigaOSFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
||||||
return new AmigaOSFilesystemNode();
|
return new AmigaOSFilesystemNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *AmigaOSFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
AbstractFSNode *AmigaOSFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
||||||
return new AmigaOSFilesystemNode(path);
|
return new AmigaOSFilesystemNode(path);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,9 +34,9 @@
|
||||||
*/
|
*/
|
||||||
class AmigaOSFilesystemFactory : public FilesystemFactory {
|
class AmigaOSFilesystemFactory : public FilesystemFactory {
|
||||||
public:
|
public:
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFSNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFSNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const;
|
virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*AMIGAOS_FILESYSTEM_FACTORY_H*/
|
#endif /*AMIGAOS_FILESYSTEM_FACTORY_H*/
|
||||||
|
|
|
@ -47,9 +47,9 @@ const uint32 kExAllBufferSize = 40960; // TODO: is this okay for sure?
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API.
|
* Implementation of the ScummVM file system API.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFSNode.
|
||||||
*/
|
*/
|
||||||
class AmigaOSFilesystemNode : public AbstractFilesystemNode {
|
class AmigaOSFilesystemNode : public AbstractFSNode {
|
||||||
protected:
|
protected:
|
||||||
BPTR _pFileLock;
|
BPTR _pFileLock;
|
||||||
Common::String _sDisplayName;
|
Common::String _sDisplayName;
|
||||||
|
@ -58,7 +58,7 @@ protected:
|
||||||
bool _bIsValid;
|
bool _bIsValid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain the FileInfoBlock protection value for this FilesystemNode,
|
* Obtain the FileInfoBlock protection value for this FSNode,
|
||||||
* as defined in the <proto/dos.h> header.
|
* as defined in the <proto/dos.h> header.
|
||||||
*
|
*
|
||||||
* @return -1 if there were errors, 0 or a positive integer otherwise.
|
* @return -1 if there were errors, 0 or a positive integer otherwise.
|
||||||
|
@ -103,9 +103,9 @@ public:
|
||||||
virtual bool isReadable() const;
|
virtual bool isReadable() const;
|
||||||
virtual bool isWritable() const;
|
virtual bool isWritable() const;
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *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 AbstractFilesystemNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *openForReading();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *openForWriting();
|
||||||
|
@ -302,7 +302,7 @@ bool AmigaOSFilesystemNode::exists() const {
|
||||||
return nodeExists;
|
return nodeExists;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *AmigaOSFilesystemNode::getChild(const Common::String &n) const {
|
AbstractFSNode *AmigaOSFilesystemNode::getChild(const Common::String &n) const {
|
||||||
ENTER();
|
ENTER();
|
||||||
if (!_bIsDirectory) {
|
if (!_bIsDirectory) {
|
||||||
debug(6, "Not a directory");
|
debug(6, "Not a directory");
|
||||||
|
@ -371,9 +371,9 @@ bool AmigaOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
|
||||||
|
|
||||||
struct ExAllData *ead = data;
|
struct ExAllData *ead = data;
|
||||||
do {
|
do {
|
||||||
if ((mode == Common::FilesystemNode::kListAll) ||
|
if ((mode == Common::FSNode::kListAll) ||
|
||||||
(EAD_IS_DRAWER(ead) && (mode == Common::FilesystemNode::kListDirectoriesOnly)) ||
|
(EAD_IS_DRAWER(ead) && (mode == Common::FSNode::kListDirectoriesOnly)) ||
|
||||||
(EAD_IS_FILE(ead) && (mode == Common::FilesystemNode::kListFilesOnly))) {
|
(EAD_IS_FILE(ead) && (mode == Common::FSNode::kListFilesOnly))) {
|
||||||
Common::String full_path = _sPath;
|
Common::String full_path = _sPath;
|
||||||
full_path += (char*)ead->ed_Name;
|
full_path += (char*)ead->ed_Name;
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ bool AmigaOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
|
||||||
if (lock) {
|
if (lock) {
|
||||||
AmigaOSFilesystemNode *entry = new AmigaOSFilesystemNode(lock, (char *)ead->ed_Name);
|
AmigaOSFilesystemNode *entry = new AmigaOSFilesystemNode(lock, (char *)ead->ed_Name);
|
||||||
if (entry) {
|
if (entry) {
|
||||||
//FIXME: since the isValid() function is no longer part of the AbstractFilesystemNode
|
//FIXME: since the isValid() function is no longer part of the AbstractFSNode
|
||||||
// specification, the following call had to be changed:
|
// specification, the following call had to be changed:
|
||||||
// if (entry->isValid())
|
// if (entry->isValid())
|
||||||
// Please verify that the logic of the code remains coherent. Also, remember
|
// Please verify that the logic of the code remains coherent. Also, remember
|
||||||
|
@ -433,7 +433,7 @@ int AmigaOSFilesystemNode::getFibProtection() const {
|
||||||
return fibProt;
|
return fibProt;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *AmigaOSFilesystemNode::getParent() const {
|
AbstractFSNode *AmigaOSFilesystemNode::getParent() const {
|
||||||
ENTER();
|
ENTER();
|
||||||
|
|
||||||
if (!_bIsDirectory) {
|
if (!_bIsDirectory) {
|
||||||
|
@ -543,7 +543,7 @@ AbstractFSList AmigaOSFilesystemNode::listVolumes() const {
|
||||||
|
|
||||||
AmigaOSFilesystemNode *entry = new AmigaOSFilesystemNode(volumeLock, buffer);
|
AmigaOSFilesystemNode *entry = new AmigaOSFilesystemNode(volumeLock, buffer);
|
||||||
if (entry) {
|
if (entry) {
|
||||||
//FIXME: since the isValid() function is no longer part of the AbstractFilesystemNode
|
//FIXME: since the isValid() function is no longer part of the AbstractFSNode
|
||||||
// specification, the following call had to be changed:
|
// specification, the following call had to be changed:
|
||||||
// if (entry->isValid())
|
// if (entry->isValid())
|
||||||
// Please verify that the logic of the code remains coherent. Also, remember
|
// Please verify that the logic of the code remains coherent. Also, remember
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
DECLARE_SINGLETON(DSFilesystemFactory);
|
DECLARE_SINGLETON(DSFilesystemFactory);
|
||||||
|
|
||||||
AbstractFilesystemNode *DSFilesystemFactory::makeRootFileNode() const {
|
AbstractFSNode *DSFilesystemFactory::makeRootFileNode() const {
|
||||||
if (DS::isGBAMPAvailable()) {
|
if (DS::isGBAMPAvailable()) {
|
||||||
return new DS::GBAMPFileSystemNode();
|
return new DS::GBAMPFileSystemNode();
|
||||||
} else {
|
} else {
|
||||||
|
@ -37,7 +37,7 @@ AbstractFilesystemNode *DSFilesystemFactory::makeRootFileNode() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *DSFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
AbstractFSNode *DSFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
||||||
if (DS::isGBAMPAvailable()) {
|
if (DS::isGBAMPAvailable()) {
|
||||||
return new DS::GBAMPFileSystemNode();
|
return new DS::GBAMPFileSystemNode();
|
||||||
} else {
|
} else {
|
||||||
|
@ -45,7 +45,7 @@ AbstractFilesystemNode *DSFilesystemFactory::makeCurrentDirectoryFileNode() cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *DSFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
AbstractFSNode *DSFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
||||||
if (DS::isGBAMPAvailable()) {
|
if (DS::isGBAMPAvailable()) {
|
||||||
return new DS::GBAMPFileSystemNode(path);
|
return new DS::GBAMPFileSystemNode(path);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -35,9 +35,9 @@
|
||||||
*/
|
*/
|
||||||
class DSFilesystemFactory : public FilesystemFactory, public Common::Singleton<DSFilesystemFactory> {
|
class DSFilesystemFactory : public FilesystemFactory, public Common::Singleton<DSFilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFSNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFSNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const;
|
virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DSFilesystemFactory() {};
|
DSFilesystemFactory() {};
|
||||||
|
|
|
@ -125,7 +125,7 @@ DSFileSystemNode::DSFileSystemNode(const DSFileSystemNode* node) {
|
||||||
//TODO: not implemented?
|
//TODO: not implemented?
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *DSFileSystemNode::getChild(const Common::String& n) const {
|
AbstractFSNode *DSFileSystemNode::getChild(const Common::String& n) const {
|
||||||
if (_path.lastChar() == '\\') {
|
if (_path.lastChar() == '\\') {
|
||||||
return new DSFileSystemNode(_path + n);
|
return new DSFileSystemNode(_path + n);
|
||||||
} else {
|
} else {
|
||||||
|
@ -168,8 +168,8 @@ bool DSFileSystemNode::getChildren(AbstractFSList &dirList, ListMode mode, bool
|
||||||
_zipFile->getFileName(n);
|
_zipFile->getFileName(n);
|
||||||
|
|
||||||
// consolePrintf("file: %s\n", n);
|
// consolePrintf("file: %s\n", n);
|
||||||
if ( (_zipFile->isDirectory() && ((mode == Common::FilesystemNode::kListDirectoriesOnly) || (mode == Common::FilesystemNode::kListAll)) )
|
if ( (_zipFile->isDirectory() && ((mode == Common::FSNode::kListDirectoriesOnly) || (mode == Common::FSNode::kListAll)) )
|
||||||
|| (!_zipFile->isDirectory() && ((mode == Common::FilesystemNode::kListFilesOnly) || (mode == Common::FilesystemNode::kListAll)) ) )
|
|| (!_zipFile->isDirectory() && ((mode == Common::FSNode::kListFilesOnly) || (mode == Common::FSNode::kListAll)) ) )
|
||||||
{
|
{
|
||||||
DSFileSystemNode* dsfsn = new DSFileSystemNode("ds:/" + Common::String(n), _zipFile->isDirectory());
|
DSFileSystemNode* dsfsn = new DSFileSystemNode("ds:/" + Common::String(n), _zipFile->isDirectory());
|
||||||
dsfsn->_isDirectory = _zipFile->isDirectory();
|
dsfsn->_isDirectory = _zipFile->isDirectory();
|
||||||
|
@ -182,7 +182,7 @@ bool DSFileSystemNode::getChildren(AbstractFSList &dirList, ListMode mode, bool
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode* DSFileSystemNode::getParent() const {
|
AbstractFSNode* DSFileSystemNode::getParent() const {
|
||||||
// consolePrintf("parent\n");
|
// consolePrintf("parent\n");
|
||||||
DSFileSystemNode *p;
|
DSFileSystemNode *p;
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const GBAMPFileSystemNode* node) {
|
||||||
//TODO: not implemented?
|
//TODO: not implemented?
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *GBAMPFileSystemNode::getChild(const Common::String& n) const {
|
AbstractFSNode *GBAMPFileSystemNode::getChild(const Common::String& n) const {
|
||||||
if (_path.lastChar() == '\\') {
|
if (_path.lastChar() == '\\') {
|
||||||
return new DSFileSystemNode(_path + n);
|
return new DSFileSystemNode(_path + n);
|
||||||
} else {
|
} else {
|
||||||
|
@ -322,8 +322,8 @@ bool GBAMPFileSystemNode::getChildren(AbstractFSList& dirList, ListMode mode, bo
|
||||||
|
|
||||||
while (entryType != TYPE_NO_MORE) {
|
while (entryType != TYPE_NO_MORE) {
|
||||||
|
|
||||||
if ( ((entryType == TYPE_DIR) && ((mode == Common::FilesystemNode::kListDirectoriesOnly) || (mode == Common::FilesystemNode::kListAll)))
|
if ( ((entryType == TYPE_DIR) && ((mode == Common::FSNode::kListDirectoriesOnly) || (mode == Common::FSNode::kListAll)))
|
||||||
|| ((entryType == TYPE_FILE) && ((mode == Common::FilesystemNode::kListFilesOnly) || (mode == Common::FilesystemNode::kListAll))) ) {
|
|| ((entryType == TYPE_FILE) && ((mode == Common::FSNode::kListFilesOnly) || (mode == Common::FSNode::kListAll))) ) {
|
||||||
GBAMPFileSystemNode* dsfsn;
|
GBAMPFileSystemNode* dsfsn;
|
||||||
|
|
||||||
consolePrintf("Fname: %s\n", fname);
|
consolePrintf("Fname: %s\n", fname);
|
||||||
|
@ -353,7 +353,7 @@ bool GBAMPFileSystemNode::getChildren(AbstractFSList& dirList, ListMode mode, bo
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode* GBAMPFileSystemNode::getParent() const {
|
AbstractFSNode* GBAMPFileSystemNode::getParent() const {
|
||||||
// consolePrintf("parent\n");
|
// consolePrintf("parent\n");
|
||||||
GBAMPFileSystemNode *p;
|
GBAMPFileSystemNode *p;
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,9 @@ namespace DS {
|
||||||
* Implementation of the ScummVM file system API.
|
* Implementation of the ScummVM file system API.
|
||||||
* This class is used when a Flash cart is in use.
|
* This class is used when a Flash cart is in use.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFSNode.
|
||||||
*/
|
*/
|
||||||
class DSFileSystemNode : public AbstractFilesystemNode {
|
class DSFileSystemNode : public AbstractFSNode {
|
||||||
protected:
|
protected:
|
||||||
static ZipFile* _zipFile;
|
static ZipFile* _zipFile;
|
||||||
|
|
||||||
|
@ -85,10 +85,10 @@ public:
|
||||||
/**
|
/**
|
||||||
* Returns a copy of this node.
|
* Returns a copy of this node.
|
||||||
*/
|
*/
|
||||||
virtual AbstractFilesystemNode *clone() const { return new DSFileSystemNode(this); }
|
virtual AbstractFSNode *clone() const { return new DSFileSystemNode(this); }
|
||||||
virtual AbstractFilesystemNode *getChild(const Common::String& name) const;
|
virtual AbstractFSNode *getChild(const Common::String& name) const;
|
||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual AbstractFilesystemNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *openForReading();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *openForWriting();
|
||||||
|
@ -104,9 +104,9 @@ public:
|
||||||
* Implementation of the ScummVM file system API.
|
* Implementation of the ScummVM file system API.
|
||||||
* This class is used when the GBAMP (GBA Movie Player) is used with a CompactFlash card.
|
* This class is used when the GBAMP (GBA Movie Player) is used with a CompactFlash card.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFSNode.
|
||||||
*/
|
*/
|
||||||
class GBAMPFileSystemNode : public AbstractFilesystemNode {
|
class GBAMPFileSystemNode : public AbstractFSNode {
|
||||||
protected:
|
protected:
|
||||||
Common::String _displayName;
|
Common::String _displayName;
|
||||||
Common::String _path;
|
Common::String _path;
|
||||||
|
@ -150,10 +150,10 @@ public:
|
||||||
/**
|
/**
|
||||||
* Returns a copy of this node.
|
* Returns a copy of this node.
|
||||||
*/
|
*/
|
||||||
virtual AbstractFilesystemNode *clone() const { return new GBAMPFileSystemNode(this); }
|
virtual AbstractFSNode *clone() const { return new GBAMPFileSystemNode(this); }
|
||||||
virtual AbstractFilesystemNode *getChild(const Common::String& name) const;
|
virtual AbstractFSNode *getChild(const Common::String& name) const;
|
||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual AbstractFilesystemNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *openForReading();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *openForWriting();
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "backends/fs/abstract-fs.h"
|
#include "backends/fs/abstract-fs.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates concrete FilesystemNode objects depending on the current architecture.
|
* Creates concrete FSNode objects depending on the current architecture.
|
||||||
*/
|
*/
|
||||||
class FilesystemFactory {
|
class FilesystemFactory {
|
||||||
public:
|
public:
|
||||||
|
@ -44,7 +44,7 @@ public:
|
||||||
* emulate it or simply return some "sensible" default directory node,
|
* emulate it or simply return some "sensible" default directory node,
|
||||||
* e.g. the same value as getRoot() returns.
|
* e.g. the same value as getRoot() returns.
|
||||||
*/
|
*/
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const = 0;
|
virtual AbstractFSNode *makeCurrentDirectoryFileNode() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a node based on a path; the path is in the same format as it
|
* Construct a node based on a path; the path is in the same format as it
|
||||||
|
@ -54,9 +54,9 @@ public:
|
||||||
* identical to oldNode. Hence, we can use the "path" value for persistent
|
* identical to oldNode. Hence, we can use the "path" value for persistent
|
||||||
* storage e.g. in the config file.
|
* storage e.g. in the config file.
|
||||||
*
|
*
|
||||||
* @param path The path string to create a FilesystemNode for.
|
* @param path The path string to create a FSNode for.
|
||||||
*/
|
*/
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const = 0;
|
virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a special node representing the filesystem root.
|
* Returns a special node representing the filesystem root.
|
||||||
|
@ -65,7 +65,7 @@ public:
|
||||||
* On Unix, this will be simply the node for / (the root directory).
|
* On Unix, this will be simply the node for / (the root directory).
|
||||||
* On Windows, it will be a special node which "contains" all drives (C:, D:, E:).
|
* On Windows, it will be a special node which "contains" all drives (C:, D:, E:).
|
||||||
*/
|
*/
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const = 0;
|
virtual AbstractFSNode *makeRootFileNode() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*FILESYSTEM_FACTORY_H*/
|
#endif /*FILESYSTEM_FACTORY_H*/
|
||||||
|
|
|
@ -28,15 +28,15 @@
|
||||||
|
|
||||||
DECLARE_SINGLETON(PalmOSFilesystemFactory);
|
DECLARE_SINGLETON(PalmOSFilesystemFactory);
|
||||||
|
|
||||||
AbstractFilesystemNode *PalmOSFilesystemFactory::makeRootFileNode() const {
|
AbstractFSNode *PalmOSFilesystemFactory::makeRootFileNode() const {
|
||||||
return new PalmOSFilesystemNode();
|
return new PalmOSFilesystemNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *PalmOSFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
AbstractFSNode *PalmOSFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
||||||
return new PalmOSFilesystemNode();
|
return new PalmOSFilesystemNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *PalmOSFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
AbstractFSNode *PalmOSFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
||||||
return new PalmOSFilesystemNode(path);
|
return new PalmOSFilesystemNode(path);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,9 +35,9 @@
|
||||||
*/
|
*/
|
||||||
class PalmOSFilesystemFactory : public FilesystemFactory, public Common::Singleton<PalmOSFilesystemFactory> {
|
class PalmOSFilesystemFactory : public FilesystemFactory, public Common::Singleton<PalmOSFilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFSNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFSNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const;
|
virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PalmOSFilesystemFactory() {};
|
PalmOSFilesystemFactory() {};
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API based on PalmOS VFS API.
|
* Implementation of the ScummVM file system API based on PalmOS VFS API.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFSNode.
|
||||||
*/
|
*/
|
||||||
class PalmOSFilesystemNode : public AbstractFilesystemNode {
|
class PalmOSFilesystemNode : public AbstractFSNode {
|
||||||
protected:
|
protected:
|
||||||
Common::String _displayName;
|
Common::String _displayName;
|
||||||
Common::String _path;
|
Common::String _path;
|
||||||
|
@ -64,9 +64,9 @@ public:
|
||||||
virtual bool isReadable() const { return true; } //FIXME: this is just a stub
|
virtual bool isReadable() const { return true; } //FIXME: this is just a stub
|
||||||
virtual bool isWritable() const { return true; } //FIXME: this is just a stub
|
virtual bool isWritable() const { return true; } //FIXME: this is just a stub
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *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 AbstractFilesystemNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *openForReading();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *openForWriting();
|
||||||
|
@ -90,8 +90,8 @@ void PalmOSFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const ch
|
||||||
|
|
||||||
isDir = (find_data->attributes & vfsFileAttrDirectory);
|
isDir = (find_data->attributes & vfsFileAttrDirectory);
|
||||||
|
|
||||||
if ((!isDir && mode == Common::FilesystemNode::kListDirectoriesOnly) ||
|
if ((!isDir && mode == Common::FSNode::kListDirectoriesOnly) ||
|
||||||
(isDir && mode == Common::FilesystemNode::kListFilesOnly))
|
(isDir && mode == Common::FSNode::kListFilesOnly))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
entry._isDirectory = isDir;
|
entry._isDirectory = isDir;
|
||||||
|
@ -139,7 +139,7 @@ PalmOSFilesystemNode::PalmOSFilesystemNode(const Common::String &p) {
|
||||||
_isPseudoRoot = false;
|
_isPseudoRoot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *PalmOSFilesystemNode::getChild(const Common::String &n) const {
|
AbstractFSNode *PalmOSFilesystemNode::getChild(const Common::String &n) const {
|
||||||
assert(_isDirectory);
|
assert(_isDirectory);
|
||||||
|
|
||||||
Common::String newPath(_path);
|
Common::String newPath(_path);
|
||||||
|
@ -190,7 +190,7 @@ bool PalmOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bo
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *PalmOSFilesystemNode::getParent() const {
|
AbstractFSNode *PalmOSFilesystemNode::getParent() const {
|
||||||
PalmOSFilesystemNode *p = 0;
|
PalmOSFilesystemNode *p = 0;
|
||||||
|
|
||||||
if (!_isPseudoRoot) {
|
if (!_isPseudoRoot) {
|
||||||
|
|
|
@ -26,17 +26,17 @@
|
||||||
#include "backends/fs/posix/posix-fs-factory.h"
|
#include "backends/fs/posix/posix-fs-factory.h"
|
||||||
#include "backends/fs/posix/posix-fs.cpp"
|
#include "backends/fs/posix/posix-fs.cpp"
|
||||||
|
|
||||||
AbstractFilesystemNode *POSIXFilesystemFactory::makeRootFileNode() const {
|
AbstractFSNode *POSIXFilesystemFactory::makeRootFileNode() const {
|
||||||
return new POSIXFilesystemNode("/");
|
return new POSIXFilesystemNode("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *POSIXFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
AbstractFSNode *POSIXFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
||||||
char buf[MAXPATHLEN];
|
char buf[MAXPATHLEN];
|
||||||
getcwd(buf, MAXPATHLEN);
|
getcwd(buf, MAXPATHLEN);
|
||||||
return new POSIXFilesystemNode(buf);
|
return new POSIXFilesystemNode(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *POSIXFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
AbstractFSNode *POSIXFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
||||||
assert(!path.empty());
|
assert(!path.empty());
|
||||||
return new POSIXFilesystemNode(path);
|
return new POSIXFilesystemNode(path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
* Parts of this class are documented in the base interface class, FilesystemFactory.
|
* Parts of this class are documented in the base interface class, FilesystemFactory.
|
||||||
*/
|
*/
|
||||||
class POSIXFilesystemFactory : public FilesystemFactory {
|
class POSIXFilesystemFactory : public FilesystemFactory {
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFSNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFSNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const;
|
virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*POSIX_FILESYSTEM_FACTORY_H*/
|
#endif /*POSIX_FILESYSTEM_FACTORY_H*/
|
||||||
|
|
|
@ -92,7 +92,7 @@ POSIXFilesystemNode::POSIXFilesystemNode(const Common::String &p) {
|
||||||
setFlags();
|
setFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *POSIXFilesystemNode::getChild(const Common::String &n) const {
|
AbstractFSNode *POSIXFilesystemNode::getChild(const Common::String &n) const {
|
||||||
assert(!_path.empty());
|
assert(!_path.empty());
|
||||||
assert(_isDirectory);
|
assert(_isDirectory);
|
||||||
|
|
||||||
|
@ -197,8 +197,8 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Honor the chosen mode
|
// Honor the chosen mode
|
||||||
if ((mode == Common::FilesystemNode::kListFilesOnly && entry._isDirectory) ||
|
if ((mode == Common::FSNode::kListFilesOnly && entry._isDirectory) ||
|
||||||
(mode == Common::FilesystemNode::kListDirectoriesOnly && !entry._isDirectory))
|
(mode == Common::FSNode::kListDirectoriesOnly && !entry._isDirectory))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
myList.push_back(new POSIXFilesystemNode(entry));
|
myList.push_back(new POSIXFilesystemNode(entry));
|
||||||
|
@ -208,7 +208,7 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *POSIXFilesystemNode::getParent() const {
|
AbstractFSNode *POSIXFilesystemNode::getParent() const {
|
||||||
if (_path == "/")
|
if (_path == "/")
|
||||||
return 0; // The filesystem root has no parent
|
return 0; // The filesystem root has no parent
|
||||||
|
|
||||||
|
|
|
@ -35,16 +35,16 @@
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API based on POSIX.
|
* Implementation of the ScummVM file system API based on POSIX.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFSNode.
|
||||||
*/
|
*/
|
||||||
class POSIXFilesystemNode : public AbstractFilesystemNode {
|
class POSIXFilesystemNode : public AbstractFSNode {
|
||||||
protected:
|
protected:
|
||||||
Common::String _displayName;
|
Common::String _displayName;
|
||||||
Common::String _path;
|
Common::String _path;
|
||||||
bool _isDirectory;
|
bool _isDirectory;
|
||||||
bool _isValid;
|
bool _isValid;
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *makeNode(const Common::String &path) const {
|
virtual AbstractFSNode *makeNode(const Common::String &path) const {
|
||||||
return new POSIXFilesystemNode(path);
|
return new POSIXFilesystemNode(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,9 +69,9 @@ public:
|
||||||
virtual bool isReadable() const { return access(_path.c_str(), R_OK) == 0; }
|
virtual bool isReadable() const { return access(_path.c_str(), R_OK) == 0; }
|
||||||
virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; }
|
virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; }
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *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 AbstractFilesystemNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *openForReading();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *openForWriting();
|
||||||
|
|
|
@ -28,15 +28,15 @@
|
||||||
|
|
||||||
DECLARE_SINGLETON(Ps2FilesystemFactory);
|
DECLARE_SINGLETON(Ps2FilesystemFactory);
|
||||||
|
|
||||||
AbstractFilesystemNode *Ps2FilesystemFactory::makeRootFileNode() const {
|
AbstractFSNode *Ps2FilesystemFactory::makeRootFileNode() const {
|
||||||
return new Ps2FilesystemNode();
|
return new Ps2FilesystemNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *Ps2FilesystemFactory::makeCurrentDirectoryFileNode() const {
|
AbstractFSNode *Ps2FilesystemFactory::makeCurrentDirectoryFileNode() const {
|
||||||
return new Ps2FilesystemNode();
|
return new Ps2FilesystemNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *Ps2FilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
AbstractFSNode *Ps2FilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
||||||
// return new Ps2FilesystemNode(path);
|
// return new Ps2FilesystemNode(path);
|
||||||
|
|
||||||
Ps2FilesystemNode *nf = new Ps2FilesystemNode(path, true);
|
Ps2FilesystemNode *nf = new Ps2FilesystemNode(path, true);
|
||||||
|
|
|
@ -35,9 +35,9 @@
|
||||||
*/
|
*/
|
||||||
class Ps2FilesystemFactory : public FilesystemFactory, public Common::Singleton<Ps2FilesystemFactory> {
|
class Ps2FilesystemFactory : public FilesystemFactory, public Common::Singleton<Ps2FilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFSNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFSNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const;
|
virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Ps2FilesystemFactory() {};
|
Ps2FilesystemFactory() {};
|
||||||
|
|
|
@ -41,9 +41,9 @@ extern OSystem_PS2 *g_systemPs2;
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API based on the Ps2SDK.
|
* Implementation of the ScummVM file system API based on the Ps2SDK.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFSNode.
|
||||||
*/
|
*/
|
||||||
class Ps2FilesystemNode : public AbstractFilesystemNode {
|
class Ps2FilesystemNode : public AbstractFSNode {
|
||||||
|
|
||||||
friend class Ps2FilesystemFactory;
|
friend class Ps2FilesystemFactory;
|
||||||
|
|
||||||
|
@ -95,10 +95,10 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *clone() const { return new Ps2FilesystemNode(this); }
|
virtual AbstractFSNode *clone() const { return new Ps2FilesystemNode(this); }
|
||||||
virtual AbstractFilesystemNode *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 AbstractFilesystemNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *openForReading();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *openForWriting();
|
||||||
|
@ -210,7 +210,7 @@ bool Ps2FilesystemNode::getDirectoryFlag(const char *path) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *Ps2FilesystemNode::getChild(const Common::String &n) const {
|
AbstractFSNode *Ps2FilesystemNode::getChild(const Common::String &n) const {
|
||||||
if (!_isDirectory)
|
if (!_isDirectory)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -288,9 +288,9 @@ bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi
|
||||||
while ((dreadRes = fio.dread(fd, &dirent)) > 0) {
|
while ((dreadRes = fio.dread(fd, &dirent)) > 0) {
|
||||||
if (dirent.name[0] == '.')
|
if (dirent.name[0] == '.')
|
||||||
continue; // ignore '.' and '..'
|
continue; // ignore '.' and '..'
|
||||||
if (((mode == Common::FilesystemNode::kListDirectoriesOnly) && (dirent.stat.mode & FIO_S_IFDIR)) ||
|
if (((mode == Common::FSNode::kListDirectoriesOnly) && (dirent.stat.mode & FIO_S_IFDIR)) ||
|
||||||
((mode == Common::FilesystemNode::kListFilesOnly) && !(dirent.stat.mode & FIO_S_IFDIR)) ||
|
((mode == Common::FSNode::kListFilesOnly) && !(dirent.stat.mode & FIO_S_IFDIR)) ||
|
||||||
(mode == Common::FilesystemNode::kListAll)) {
|
(mode == Common::FSNode::kListAll)) {
|
||||||
|
|
||||||
dirEntry._isDirectory = (bool)(dirent.stat.mode & FIO_S_IFDIR);
|
dirEntry._isDirectory = (bool)(dirent.stat.mode & FIO_S_IFDIR);
|
||||||
dirEntry._isRoot = false;
|
dirEntry._isRoot = false;
|
||||||
|
@ -312,7 +312,7 @@ bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *Ps2FilesystemNode::getParent() const {
|
AbstractFSNode *Ps2FilesystemNode::getParent() const {
|
||||||
if (_isRoot)
|
if (_isRoot)
|
||||||
return new Ps2FilesystemNode(this);
|
return new Ps2FilesystemNode(this);
|
||||||
|
|
||||||
|
|
|
@ -28,15 +28,15 @@
|
||||||
|
|
||||||
DECLARE_SINGLETON(PSPFilesystemFactory);
|
DECLARE_SINGLETON(PSPFilesystemFactory);
|
||||||
|
|
||||||
AbstractFilesystemNode *PSPFilesystemFactory::makeRootFileNode() const {
|
AbstractFSNode *PSPFilesystemFactory::makeRootFileNode() const {
|
||||||
return new PSPFilesystemNode();
|
return new PSPFilesystemNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *PSPFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
AbstractFSNode *PSPFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
||||||
return new PSPFilesystemNode();
|
return new PSPFilesystemNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *PSPFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
AbstractFSNode *PSPFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
||||||
return new PSPFilesystemNode(path, true);
|
return new PSPFilesystemNode(path, true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,9 +35,9 @@
|
||||||
*/
|
*/
|
||||||
class PSPFilesystemFactory : public FilesystemFactory, public Common::Singleton<PSPFilesystemFactory> {
|
class PSPFilesystemFactory : public FilesystemFactory, public Common::Singleton<PSPFilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFSNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFSNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const;
|
virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PSPFilesystemFactory() {};
|
PSPFilesystemFactory() {};
|
||||||
|
|
|
@ -36,9 +36,9 @@
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API based on PSPSDK API.
|
* Implementation of the ScummVM file system API based on PSPSDK API.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFSNode.
|
||||||
*/
|
*/
|
||||||
class PSPFilesystemNode : public AbstractFilesystemNode {
|
class PSPFilesystemNode : public AbstractFSNode {
|
||||||
protected:
|
protected:
|
||||||
Common::String _displayName;
|
Common::String _displayName;
|
||||||
Common::String _path;
|
Common::String _path;
|
||||||
|
@ -67,9 +67,9 @@ public:
|
||||||
virtual bool isReadable() const { return access(_path.c_str(), R_OK) == 0; }
|
virtual bool isReadable() const { return access(_path.c_str(), R_OK) == 0; }
|
||||||
virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; }
|
virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; }
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *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 AbstractFilesystemNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *openForReading();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *openForWriting();
|
||||||
|
@ -97,7 +97,7 @@ PSPFilesystemNode::PSPFilesystemNode(const Common::String &p, bool verify) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *PSPFilesystemNode::getChild(const Common::String &n) const {
|
AbstractFSNode *PSPFilesystemNode::getChild(const Common::String &n) const {
|
||||||
// FIXME: Pretty lame implementation! We do no error checking to speak
|
// FIXME: Pretty lame implementation! We do no error checking to speak
|
||||||
// of, do not check if this is a special node, etc.
|
// of, do not check if this is a special node, etc.
|
||||||
assert(_isDirectory);
|
assert(_isDirectory);
|
||||||
|
@ -137,8 +137,8 @@ bool PSPFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool
|
||||||
entry._path += "/";
|
entry._path += "/";
|
||||||
|
|
||||||
// Honor the chosen mode
|
// Honor the chosen mode
|
||||||
if ((mode == Common::FilesystemNode::kListFilesOnly && entry._isDirectory) ||
|
if ((mode == Common::FSNode::kListFilesOnly && entry._isDirectory) ||
|
||||||
(mode == Common::FilesystemNode::kListDirectoriesOnly && !entry._isDirectory))
|
(mode == Common::FSNode::kListDirectoriesOnly && !entry._isDirectory))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
myList.push_back(new PSPFilesystemNode(entry));
|
myList.push_back(new PSPFilesystemNode(entry));
|
||||||
|
@ -151,7 +151,7 @@ bool PSPFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *PSPFilesystemNode::getParent() const {
|
AbstractFSNode *PSPFilesystemNode::getParent() const {
|
||||||
if (_path == ROOT_PATH)
|
if (_path == ROOT_PATH)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -26,17 +26,17 @@
|
||||||
#include "backends/fs/symbian/symbian-fs-factory.h"
|
#include "backends/fs/symbian/symbian-fs-factory.h"
|
||||||
#include "backends/fs/symbian/symbian-fs.cpp"
|
#include "backends/fs/symbian/symbian-fs.cpp"
|
||||||
|
|
||||||
AbstractFilesystemNode *SymbianFilesystemFactory::makeRootFileNode() const {
|
AbstractFSNode *SymbianFilesystemFactory::makeRootFileNode() const {
|
||||||
return new SymbianFilesystemNode(true);
|
return new SymbianFilesystemNode(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *SymbianFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
AbstractFSNode *SymbianFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
||||||
char path[MAXPATHLEN];
|
char path[MAXPATHLEN];
|
||||||
getcwd(path, MAXPATHLEN);
|
getcwd(path, MAXPATHLEN);
|
||||||
return new SymbianFilesystemNode(path);
|
return new SymbianFilesystemNode(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *SymbianFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
AbstractFSNode *SymbianFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
||||||
return new SymbianFilesystemNode(path);
|
return new SymbianFilesystemNode(path);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,9 +34,9 @@
|
||||||
*/
|
*/
|
||||||
class SymbianFilesystemFactory : public FilesystemFactory {
|
class SymbianFilesystemFactory : public FilesystemFactory {
|
||||||
public:
|
public:
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFSNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFSNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const;
|
virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*SYMBIAN_FILESYSTEM_FACTORY_H*/
|
#endif /*SYMBIAN_FILESYSTEM_FACTORY_H*/
|
||||||
|
|
|
@ -37,9 +37,9 @@
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API based on POSIX.
|
* Implementation of the ScummVM file system API based on POSIX.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFSNode.
|
||||||
*/
|
*/
|
||||||
class SymbianFilesystemNode : public AbstractFilesystemNode {
|
class SymbianFilesystemNode : public AbstractFSNode {
|
||||||
protected:
|
protected:
|
||||||
Common::String _displayName;
|
Common::String _displayName;
|
||||||
Common::String _path;
|
Common::String _path;
|
||||||
|
@ -75,9 +75,9 @@ public:
|
||||||
virtual bool isReadable() const { return access(_path.c_str(), R_OK) == 0; } //FIXME: this is just a stub
|
virtual bool isReadable() const { return access(_path.c_str(), R_OK) == 0; } //FIXME: this is just a stub
|
||||||
virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; } //FIXME: this is just a stub
|
virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; } //FIXME: this is just a stub
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *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 AbstractFilesystemNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *openForReading();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *openForWriting();
|
||||||
|
@ -133,7 +133,7 @@ SymbianFilesystemNode::SymbianFilesystemNode(const Common::String &path) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *SymbianFilesystemNode::getChild(const Common::String &n) const {
|
AbstractFSNode *SymbianFilesystemNode::getChild(const Common::String &n) const {
|
||||||
assert(_isDirectory);
|
assert(_isDirectory);
|
||||||
Common::String newPath(_path);
|
Common::String newPath(_path);
|
||||||
|
|
||||||
|
@ -216,8 +216,8 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
|
||||||
entry._isDirectory = fileentry.IsDir();
|
entry._isDirectory = fileentry.IsDir();
|
||||||
|
|
||||||
// Honor the chosen mode
|
// Honor the chosen mode
|
||||||
if ((mode == Common::FilesystemNode::kListFilesOnly && entry._isDirectory) ||
|
if ((mode == Common::FSNode::kListFilesOnly && entry._isDirectory) ||
|
||||||
(mode == Common::FilesystemNode::kListDirectoriesOnly && !entry._isDirectory))
|
(mode == Common::FSNode::kListDirectoriesOnly && !entry._isDirectory))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
myList.push_back(new SymbianFilesystemNode(entry));
|
myList.push_back(new SymbianFilesystemNode(entry));
|
||||||
|
@ -229,7 +229,7 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *SymbianFilesystemNode::getParent() const {
|
AbstractFSNode *SymbianFilesystemNode::getParent() const {
|
||||||
SymbianFilesystemNode *p =NULL;
|
SymbianFilesystemNode *p =NULL;
|
||||||
|
|
||||||
// Root node is its own parent. Still we can't just return this
|
// Root node is its own parent. Still we can't just return this
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
|
|
||||||
DECLARE_SINGLETON(WiiFilesystemFactory);
|
DECLARE_SINGLETON(WiiFilesystemFactory);
|
||||||
|
|
||||||
AbstractFilesystemNode *WiiFilesystemFactory::makeRootFileNode() const {
|
AbstractFSNode *WiiFilesystemFactory::makeRootFileNode() const {
|
||||||
return new WiiFilesystemNode();
|
return new WiiFilesystemNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *WiiFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
AbstractFSNode *WiiFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
||||||
char buf[MAXPATHLEN];
|
char buf[MAXPATHLEN];
|
||||||
|
|
||||||
if (getcwd(buf, MAXPATHLEN))
|
if (getcwd(buf, MAXPATHLEN))
|
||||||
|
@ -42,7 +42,7 @@ AbstractFilesystemNode *WiiFilesystemFactory::makeCurrentDirectoryFileNode() con
|
||||||
return new WiiFilesystemNode();
|
return new WiiFilesystemNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *WiiFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
AbstractFSNode *WiiFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
||||||
return new WiiFilesystemNode(path, true);
|
return new WiiFilesystemNode(path, true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
*/
|
*/
|
||||||
class WiiFilesystemFactory : public FilesystemFactory, public Common::Singleton<WiiFilesystemFactory> {
|
class WiiFilesystemFactory : public FilesystemFactory, public Common::Singleton<WiiFilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFSNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFSNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const;
|
virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WiiFilesystemFactory() {};
|
WiiFilesystemFactory() {};
|
||||||
|
|
|
@ -34,9 +34,9 @@
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API based on Wii.
|
* Implementation of the ScummVM file system API based on Wii.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFSNode.
|
||||||
*/
|
*/
|
||||||
class WiiFilesystemNode : public AbstractFilesystemNode {
|
class WiiFilesystemNode : public AbstractFSNode {
|
||||||
protected:
|
protected:
|
||||||
Common::String _displayName;
|
Common::String _displayName;
|
||||||
Common::String _path;
|
Common::String _path;
|
||||||
|
@ -64,9 +64,9 @@ public:
|
||||||
virtual bool isReadable() const { return _isReadable; }
|
virtual bool isReadable() const { return _isReadable; }
|
||||||
virtual bool isWritable() const { return _isWritable; }
|
virtual bool isWritable() const { return _isWritable; }
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *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 AbstractFilesystemNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *openForReading();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *openForWriting();
|
||||||
|
@ -114,7 +114,7 @@ bool WiiFilesystemNode::exists() const {
|
||||||
return stat(_path.c_str (), &st) == 0;
|
return stat(_path.c_str (), &st) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *WiiFilesystemNode::getChild(const Common::String &n) const {
|
AbstractFSNode *WiiFilesystemNode::getChild(const Common::String &n) const {
|
||||||
assert(_isDirectory);
|
assert(_isDirectory);
|
||||||
|
|
||||||
Common::String newPath(_path);
|
Common::String newPath(_path);
|
||||||
|
@ -147,8 +147,8 @@ bool WiiFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool
|
||||||
|
|
||||||
bool isDir = S_ISDIR(st.st_mode);
|
bool isDir = S_ISDIR(st.st_mode);
|
||||||
|
|
||||||
if ((mode == Common::FilesystemNode::kListFilesOnly && isDir) ||
|
if ((mode == Common::FSNode::kListFilesOnly && isDir) ||
|
||||||
(mode == Common::FilesystemNode::kListDirectoriesOnly && !isDir))
|
(mode == Common::FSNode::kListDirectoriesOnly && !isDir))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (isDir)
|
if (isDir)
|
||||||
|
@ -162,7 +162,7 @@ bool WiiFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *WiiFilesystemNode::getParent() const {
|
AbstractFSNode *WiiFilesystemNode::getParent() const {
|
||||||
if (_path == "/")
|
if (_path == "/")
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -26,15 +26,15 @@
|
||||||
#include "backends/fs/windows/windows-fs-factory.h"
|
#include "backends/fs/windows/windows-fs-factory.h"
|
||||||
#include "backends/fs/windows/windows-fs.cpp"
|
#include "backends/fs/windows/windows-fs.cpp"
|
||||||
|
|
||||||
AbstractFilesystemNode *WindowsFilesystemFactory::makeRootFileNode() const {
|
AbstractFSNode *WindowsFilesystemFactory::makeRootFileNode() const {
|
||||||
return new WindowsFilesystemNode();
|
return new WindowsFilesystemNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *WindowsFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
AbstractFSNode *WindowsFilesystemFactory::makeCurrentDirectoryFileNode() const {
|
||||||
return new WindowsFilesystemNode("", true);
|
return new WindowsFilesystemNode("", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *WindowsFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
AbstractFSNode *WindowsFilesystemFactory::makeFileNodePath(const Common::String &path) const {
|
||||||
return new WindowsFilesystemNode(path, false);
|
return new WindowsFilesystemNode(path, false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,9 +34,9 @@
|
||||||
*/
|
*/
|
||||||
class WindowsFilesystemFactory : public FilesystemFactory {
|
class WindowsFilesystemFactory : public FilesystemFactory {
|
||||||
public:
|
public:
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFSNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFSNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const;
|
virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*WINDOWS_FILESYSTEM_FACTORY_H*/
|
#endif /*WINDOWS_FILESYSTEM_FACTORY_H*/
|
||||||
|
|
|
@ -55,9 +55,9 @@
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API based on Windows API.
|
* Implementation of the ScummVM file system API based on Windows API.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFSNode.
|
||||||
*/
|
*/
|
||||||
class WindowsFilesystemNode : public AbstractFilesystemNode {
|
class WindowsFilesystemNode : public AbstractFSNode {
|
||||||
protected:
|
protected:
|
||||||
Common::String _displayName;
|
Common::String _displayName;
|
||||||
Common::String _path;
|
Common::String _path;
|
||||||
|
@ -95,9 +95,9 @@ public:
|
||||||
virtual bool isReadable() const { return _access(_path.c_str(), R_OK) == 0; }
|
virtual bool isReadable() const { return _access(_path.c_str(), R_OK) == 0; }
|
||||||
virtual bool isWritable() const { return _access(_path.c_str(), W_OK) == 0; }
|
virtual bool isWritable() const { return _access(_path.c_str(), W_OK) == 0; }
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *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 AbstractFilesystemNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *openForReading();
|
||||||
virtual Common::WriteStream *openForWriting();
|
virtual Common::WriteStream *openForWriting();
|
||||||
|
@ -142,8 +142,8 @@ void WindowsFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const c
|
||||||
|
|
||||||
isDirectory = (find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? true : false);
|
isDirectory = (find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? true : false);
|
||||||
|
|
||||||
if ((!isDirectory && mode == Common::FilesystemNode::kListDirectoriesOnly) ||
|
if ((!isDirectory && mode == Common::FSNode::kListDirectoriesOnly) ||
|
||||||
(isDirectory && mode == Common::FilesystemNode::kListFilesOnly))
|
(isDirectory && mode == Common::FSNode::kListFilesOnly))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
entry._isDirectory = isDirectory;
|
entry._isDirectory = isDirectory;
|
||||||
|
@ -223,7 +223,7 @@ WindowsFilesystemNode::WindowsFilesystemNode(const Common::String &p, const bool
|
||||||
_isPseudoRoot = false;
|
_isPseudoRoot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *WindowsFilesystemNode::getChild(const Common::String &n) const {
|
AbstractFSNode *WindowsFilesystemNode::getChild(const Common::String &n) const {
|
||||||
assert(_isDirectory);
|
assert(_isDirectory);
|
||||||
|
|
||||||
Common::String newPath(_path);
|
Common::String newPath(_path);
|
||||||
|
@ -285,7 +285,7 @@ bool WindowsFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *WindowsFilesystemNode::getParent() const {
|
AbstractFSNode *WindowsFilesystemNode::getParent() const {
|
||||||
assert(_isValid || _isPseudoRoot);
|
assert(_isValid || _isPseudoRoot);
|
||||||
|
|
||||||
if (_isPseudoRoot)
|
if (_isPseudoRoot)
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API based on Ronin.
|
* Implementation of the ScummVM file system API based on Ronin.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFSNode.
|
||||||
*/
|
*/
|
||||||
class RoninCDFileNode : public AbstractFilesystemNode {
|
class RoninCDFileNode : public AbstractFSNode {
|
||||||
protected:
|
protected:
|
||||||
Common::String _path;
|
Common::String _path;
|
||||||
|
|
||||||
|
@ -49,14 +49,14 @@ public:
|
||||||
virtual bool isReadable() const { return true; }
|
virtual bool isReadable() const { return true; }
|
||||||
virtual bool isWritable() const { return false; }
|
virtual bool isWritable() const { return false; }
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *getChild(const Common::String &n) const { return NULL; }
|
virtual AbstractFSNode *getChild(const Common::String &n) const { return NULL; }
|
||||||
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 AbstractFilesystemNode *getParent() const;
|
virtual AbstractFSNode *getParent() const;
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *openForReading();
|
virtual Common::SeekableReadStream *openForReading();
|
||||||
virtual Common::WriteStream *openForWriting() { return 0; }
|
virtual Common::WriteStream *openForWriting() { return 0; }
|
||||||
|
|
||||||
static AbstractFilesystemNode *makeFileNodePath(const Common::String &path);
|
static AbstractFSNode *makeFileNodePath(const Common::String &path);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A directory */
|
/* A directory */
|
||||||
|
@ -65,7 +65,7 @@ public:
|
||||||
RoninCDDirectoryNode(const Common::String &path) : RoninCDFileNode(path) {};
|
RoninCDDirectoryNode(const Common::String &path) : RoninCDFileNode(path) {};
|
||||||
|
|
||||||
virtual bool isDirectory() const { return true; }
|
virtual bool isDirectory() const { return true; }
|
||||||
virtual AbstractFilesystemNode *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 *openForReading() { return 0; }
|
||||||
};
|
};
|
||||||
|
@ -80,7 +80,7 @@ public:
|
||||||
virtual Common::SeekableReadStream *openForReading() { return 0; }
|
virtual Common::SeekableReadStream *openForReading() { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
AbstractFilesystemNode *RoninCDFileNode::makeFileNodePath(const Common::String &path) {
|
AbstractFSNode *RoninCDFileNode::makeFileNodePath(const Common::String &path) {
|
||||||
assert(path.size() > 0);
|
assert(path.size() > 0);
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -96,7 +96,7 @@ AbstractFilesystemNode *RoninCDFileNode::makeFileNodePath(const Common::String &
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *RoninCDDirectoryNode::getChild(const Common::String &n) const {
|
AbstractFSNode *RoninCDDirectoryNode::getChild(const Common::String &n) const {
|
||||||
Common::String newPath(_path);
|
Common::String newPath(_path);
|
||||||
if (_path.lastChar() != '/')
|
if (_path.lastChar() != '/')
|
||||||
newPath += '/';
|
newPath += '/';
|
||||||
|
@ -122,13 +122,13 @@ bool RoninCDDirectoryNode::getChildren(AbstractFSList &myList, ListMode mode, bo
|
||||||
|
|
||||||
if (dp->d_size < 0) {
|
if (dp->d_size < 0) {
|
||||||
// Honor the chosen mode
|
// Honor the chosen mode
|
||||||
if (mode == Common::FilesystemNode::kListFilesOnly)
|
if (mode == Common::FSNode::kListFilesOnly)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
myList.push_back(new RoninCDDirectoryNode(newPath+"/"));
|
myList.push_back(new RoninCDDirectoryNode(newPath+"/"));
|
||||||
} else {
|
} else {
|
||||||
// Honor the chosen mode
|
// Honor the chosen mode
|
||||||
if (mode == Common::FilesystemNode::kListDirectoriesOnly)
|
if (mode == Common::FSNode::kListDirectoriesOnly)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
myList.push_back(new RoninCDFileNode(newPath));
|
myList.push_back(new RoninCDFileNode(newPath));
|
||||||
|
@ -139,7 +139,7 @@ bool RoninCDDirectoryNode::getChildren(AbstractFSList &myList, ListMode mode, bo
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *RoninCDFileNode::getParent() const {
|
AbstractFSNode *RoninCDFileNode::getParent() const {
|
||||||
if (_path == "/")
|
if (_path == "/")
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -154,16 +154,16 @@ Common::SeekableReadStream *RoninCDFileNode::openForReading() {
|
||||||
return StdioStream::makeFromPath(getPath().c_str(), false);
|
return StdioStream::makeFromPath(getPath().c_str(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *OSystem_Dreamcast::makeRootFileNode() const {
|
AbstractFSNode *OSystem_Dreamcast::makeRootFileNode() const {
|
||||||
return new RoninCDDirectoryNode("/");
|
return new RoninCDDirectoryNode("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *OSystem_Dreamcast::makeCurrentDirectoryFileNode() const {
|
AbstractFSNode *OSystem_Dreamcast::makeCurrentDirectoryFileNode() const {
|
||||||
return makeRootFileNode();
|
return makeRootFileNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *OSystem_Dreamcast::makeFileNodePath(const Common::String &path) const {
|
AbstractFSNode *OSystem_Dreamcast::makeFileNodePath(const Common::String &path) const {
|
||||||
AbstractFilesystemNode *node = RoninCDFileNode::makeFileNodePath(path);
|
AbstractFSNode *node = RoninCDFileNode::makeFileNodePath(path);
|
||||||
return (node? node : new RoninCDNonexistingNode(path));
|
return (node? node : new RoninCDNonexistingNode(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,9 +189,9 @@ class OSystem_Dreamcast : public OSystem, public FilesystemFactory {
|
||||||
|
|
||||||
// Filesystem
|
// Filesystem
|
||||||
FilesystemFactory *getFilesystemFactory() { return this; }
|
FilesystemFactory *getFilesystemFactory() { return this; }
|
||||||
AbstractFilesystemNode *makeRootFileNode() const;
|
AbstractFSNode *makeRootFileNode() const;
|
||||||
AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
AbstractFSNode *makeCurrentDirectoryFileNode() const;
|
||||||
AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const;
|
AbstractFSNode *makeFileNodePath(const Common::String &path) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -146,12 +146,12 @@ struct Dir
|
||||||
{
|
{
|
||||||
char name[252];
|
char name[252];
|
||||||
char deficon[256];
|
char deficon[256];
|
||||||
Common::FilesystemNode node;
|
Common::FSNode node;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Game the_game;
|
static Game the_game;
|
||||||
|
|
||||||
static bool isIcon(const Common::FilesystemNode &entry)
|
static bool isIcon(const Common::FSNode &entry)
|
||||||
{
|
{
|
||||||
int l = entry.getDisplayName().size();
|
int l = entry.getDisplayName().size();
|
||||||
if (l>4 && !strcasecmp(entry.getDisplayName().c_str()+l-4, ".ICO"))
|
if (l>4 && !strcasecmp(entry.getDisplayName().c_str()+l-4, ".ICO"))
|
||||||
|
@ -198,13 +198,13 @@ static int findGames(Game *games, int max)
|
||||||
{
|
{
|
||||||
Dir *dirs = new Dir[MAX_DIR];
|
Dir *dirs = new Dir[MAX_DIR];
|
||||||
int curr_game = 0, curr_dir = 0, num_dirs = 1;
|
int curr_game = 0, curr_dir = 0, num_dirs = 1;
|
||||||
dirs[0].node = Common::FilesystemNode("");
|
dirs[0].node = Common::FSNode("");
|
||||||
while (curr_game < max && curr_dir < num_dirs) {
|
while (curr_game < max && curr_dir < num_dirs) {
|
||||||
strncpy(dirs[curr_dir].name, dirs[curr_dir].node.getPath().c_str(), 252);
|
strncpy(dirs[curr_dir].name, dirs[curr_dir].node.getPath().c_str(), 252);
|
||||||
dirs[curr_dir].name[251] = '\0';
|
dirs[curr_dir].name[251] = '\0';
|
||||||
dirs[curr_dir].deficon[0] = '\0';
|
dirs[curr_dir].deficon[0] = '\0';
|
||||||
Common::FSList files, fslist;
|
Common::FSList files, fslist;
|
||||||
dirs[curr_dir++].node.getChildren(fslist, Common::FilesystemNode::kListAll);
|
dirs[curr_dir++].node.getChildren(fslist, Common::FSNode::kListAll);
|
||||||
for (Common::FSList::const_iterator entry = fslist.begin(); entry != fslist.end();
|
for (Common::FSList::const_iterator entry = fslist.begin(); entry != fslist.end();
|
||||||
++entry) {
|
++entry) {
|
||||||
if (entry->isDirectory()) {
|
if (entry->isDirectory()) {
|
||||||
|
|
|
@ -280,7 +280,7 @@ void OSystem_SDL::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
|
||||||
#ifdef DATA_PATH
|
#ifdef DATA_PATH
|
||||||
// Add the global DATA_PATH to the directory search list
|
// Add the global DATA_PATH to the directory search list
|
||||||
// FIXME: We use depth = 4 for now, to match the old code. May want to change that
|
// FIXME: We use depth = 4 for now, to match the old code. May want to change that
|
||||||
Common::FilesystemNode dataNode(DATA_PATH);
|
Common::FSNode dataNode(DATA_PATH);
|
||||||
if (dataNode.exists() && dataNode.isDirectory()) {
|
if (dataNode.exists() && dataNode.isDirectory()) {
|
||||||
Common::ArchivePtr dataArchive(new Common::FSDirectory(dataNode, 4));
|
Common::ArchivePtr dataArchive(new Common::FSDirectory(dataNode, 4));
|
||||||
s.add(DATA_PATH, dataArchive, priority);
|
s.add(DATA_PATH, dataArchive, priority);
|
||||||
|
@ -373,12 +373,12 @@ static Common::String getDefaultConfigFileName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *OSystem_SDL::openConfigFileForReading() {
|
Common::SeekableReadStream *OSystem_SDL::openConfigFileForReading() {
|
||||||
Common::FilesystemNode file(getDefaultConfigFileName());
|
Common::FSNode file(getDefaultConfigFileName());
|
||||||
return file.openForReading();
|
return file.openForReading();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *OSystem_SDL::openConfigFileForWriting() {
|
Common::WriteStream *OSystem_SDL::openConfigFileForWriting() {
|
||||||
Common::FilesystemNode file(getDefaultConfigFileName());
|
Common::FSNode file(getDefaultConfigFileName());
|
||||||
return file.openForWriting();
|
return file.openForWriting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,12 +124,12 @@ static Common::String getDefaultConfigFileName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *OSystem_SDL_Symbian::openConfigFileForReading() {
|
Common::SeekableReadStream *OSystem_SDL_Symbian::openConfigFileForReading() {
|
||||||
Common::FilesystemNode file(getDefaultConfigFileName());
|
Common::FSNode file(getDefaultConfigFileName());
|
||||||
return file.openForReading();
|
return file.openForReading();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *OSystem_SDL_Symbian::openConfigFileForWriting() {
|
Common::WriteStream *OSystem_SDL_Symbian::openConfigFileForWriting() {
|
||||||
Common::FilesystemNode file(getDefaultConfigFileName());
|
Common::FSNode file(getDefaultConfigFileName());
|
||||||
return file.openForWriting();
|
return file.openForWriting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,10 +72,10 @@ void CELauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CELauncherDialog::automaticScanDirectory(const Common::FilesystemNode &node) {
|
void CELauncherDialog::automaticScanDirectory(const Common::FSNode &node) {
|
||||||
// First check if we have a recognized game in the current directory
|
// First check if we have a recognized game in the current directory
|
||||||
Common::FSList files;
|
Common::FSList files;
|
||||||
node.getChildren(files, Common::FilesystemNode::kListFilesOnly);
|
node.getChildren(files, Common::FSNode::kListFilesOnly);
|
||||||
// detect
|
// detect
|
||||||
GameList candidates(EngineMan.detectGames(files));
|
GameList candidates(EngineMan.detectGames(files));
|
||||||
// insert
|
// insert
|
||||||
|
@ -86,7 +86,7 @@ void CELauncherDialog::automaticScanDirectory(const Common::FilesystemNode &node
|
||||||
}
|
}
|
||||||
// Then recurse on the subdirectories
|
// Then recurse on the subdirectories
|
||||||
Common::FSList dirs;
|
Common::FSList dirs;
|
||||||
node.getChildren(dirs, Common::FilesystemNode::kListDirectoriesOnly);
|
node.getChildren(dirs, Common::FSNode::kListDirectoriesOnly);
|
||||||
for (Common::FSList::const_iterator currentDir = dirs.begin(); currentDir != dirs.end(); ++currentDir)
|
for (Common::FSList::const_iterator currentDir = dirs.begin(); currentDir != dirs.end(); ++currentDir)
|
||||||
automaticScanDirectory(*currentDir);
|
automaticScanDirectory(*currentDir);
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
|
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
|
||||||
protected:
|
protected:
|
||||||
void addGame();
|
void addGame();
|
||||||
void automaticScanDirectory(const Common::FilesystemNode &node);
|
void automaticScanDirectory(const Common::FSNode &node);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef GUI::LauncherDialog GUILauncherDialog;
|
typedef GUI::LauncherDialog GUILauncherDialog;
|
||||||
|
|
|
@ -84,11 +84,11 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Plugin* DCPluginProvider::createPlugin(const Common::FilesystemNode &node) const {
|
Plugin* DCPluginProvider::createPlugin(const Common::FSNode &node) const {
|
||||||
return new DCPlugin(node.getPath());
|
return new DCPlugin(node.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DCPluginProvider::isPluginFilename(const Common::FilesystemNode &node) const {
|
bool DCPluginProvider::isPluginFilename(const Common::FSNode &node) const {
|
||||||
// Check the plugin suffix
|
// Check the plugin suffix
|
||||||
Common::String filename = node.getName();
|
Common::String filename = node.getName();
|
||||||
if (!filename.hasSuffix(".PLG"))
|
if (!filename.hasSuffix(".PLG"))
|
||||||
|
|
|
@ -32,9 +32,9 @@
|
||||||
|
|
||||||
class DCPluginProvider : public FilePluginProvider {
|
class DCPluginProvider : public FilePluginProvider {
|
||||||
protected:
|
protected:
|
||||||
Plugin* createPlugin(const Common::FilesystemNode &node) const;
|
Plugin* createPlugin(const Common::FSNode &node) const;
|
||||||
|
|
||||||
bool isPluginFilename(const Common::FilesystemNode &node) const;
|
bool isPluginFilename(const Common::FSNode &node) const;
|
||||||
|
|
||||||
virtual void addCustomDirectories(Common::StringList &dirs) const {
|
virtual void addCustomDirectories(Common::StringList &dirs) const {
|
||||||
dirs.push_back("/");
|
dirs.push_back("/");
|
||||||
|
|
|
@ -79,7 +79,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Plugin* POSIXPluginProvider::createPlugin(const Common::FilesystemNode &node) const {
|
Plugin* POSIXPluginProvider::createPlugin(const Common::FSNode &node) const {
|
||||||
return new POSIXPlugin(node.getPath());
|
return new POSIXPlugin(node.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
class POSIXPluginProvider : public FilePluginProvider {
|
class POSIXPluginProvider : public FilePluginProvider {
|
||||||
protected:
|
protected:
|
||||||
Plugin* createPlugin(const Common::FilesystemNode &node) const;
|
Plugin* createPlugin(const Common::FSNode &node) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // defined(DYNAMIC_MODULES) && defined(UNIX)
|
#endif // defined(DYNAMIC_MODULES) && defined(UNIX)
|
||||||
|
|
|
@ -79,7 +79,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Plugin* SDLPluginProvider::createPlugin(const Common::FilesystemNode &node) const {
|
Plugin* SDLPluginProvider::createPlugin(const Common::FSNode &node) const {
|
||||||
return new SDLPlugin(node.getPath());
|
return new SDLPlugin(node.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
class SDLPluginProvider : public FilePluginProvider {
|
class SDLPluginProvider : public FilePluginProvider {
|
||||||
protected:
|
protected:
|
||||||
Plugin* createPlugin(const Common::FilesystemNode &node) const;
|
Plugin* createPlugin(const Common::FSNode &node) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // defined(DYNAMIC_MODULES) && defined(UNIX)
|
#endif // defined(DYNAMIC_MODULES) && defined(UNIX)
|
||||||
|
|
|
@ -97,11 +97,11 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Plugin* Win32PluginProvider::createPlugin(const Common::FilesystemNode &node) const {
|
Plugin* Win32PluginProvider::createPlugin(const Common::FSNode &node) const {
|
||||||
return new Win32Plugin(node.getPath());
|
return new Win32Plugin(node.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Win32PluginProvider::isPluginFilename(const Common::FilesystemNode &node) const {
|
bool Win32PluginProvider::isPluginFilename(const Common::FSNode &node) const {
|
||||||
// Check the plugin suffix
|
// Check the plugin suffix
|
||||||
Common::String filename = node.getName();
|
Common::String filename = node.getName();
|
||||||
if (!filename.hasSuffix(".dll"))
|
if (!filename.hasSuffix(".dll"))
|
||||||
|
|
|
@ -32,9 +32,9 @@
|
||||||
|
|
||||||
class Win32PluginProvider : public FilePluginProvider {
|
class Win32PluginProvider : public FilePluginProvider {
|
||||||
protected:
|
protected:
|
||||||
Plugin* createPlugin(const Common::FilesystemNode &node) const;
|
Plugin* createPlugin(const Common::FSNode &node) const;
|
||||||
|
|
||||||
bool isPluginFilename(const Common::FilesystemNode &node) const;
|
bool isPluginFilename(const Common::FSNode &node) const;
|
||||||
|
|
||||||
virtual void addCustomDirectories(Common::StringList &dirs) const {}
|
virtual void addCustomDirectories(Common::StringList &dirs) const {}
|
||||||
};
|
};
|
||||||
|
|
|
@ -71,7 +71,7 @@ DefaultSaveFileManager::DefaultSaveFileManager(const Common::String &defaultSave
|
||||||
|
|
||||||
|
|
||||||
Common::StringList DefaultSaveFileManager::listSavefiles(const char *pattern) {
|
Common::StringList DefaultSaveFileManager::listSavefiles(const char *pattern) {
|
||||||
Common::FilesystemNode savePath(getSavePath());
|
Common::FSNode savePath(getSavePath());
|
||||||
Common::FSList savefiles;
|
Common::FSList savefiles;
|
||||||
Common::StringList results;
|
Common::StringList results;
|
||||||
Common::String search(pattern);
|
Common::String search(pattern);
|
||||||
|
@ -85,7 +85,7 @@ Common::StringList DefaultSaveFileManager::listSavefiles(const char *pattern) {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultSaveFileManager::checkPath(const Common::FilesystemNode &dir) {
|
void DefaultSaveFileManager::checkPath(const Common::FSNode &dir) {
|
||||||
const Common::String path = dir.getPath();
|
const Common::String path = dir.getPath();
|
||||||
clearError();
|
clearError();
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ void DefaultSaveFileManager::checkPath(const Common::FilesystemNode &dir) {
|
||||||
#else
|
#else
|
||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
// TODO: We could try to mkdir the directory here; or rather, we could
|
// TODO: We could try to mkdir the directory here; or rather, we could
|
||||||
// add a mkdir method to FilesystemNode and invoke that here.
|
// add a mkdir method to FSNode and invoke that here.
|
||||||
setError(SFM_DIR_NOENT, "A component of the path does not exist, or the path is an empty string: "+path);
|
setError(SFM_DIR_NOENT, "A component of the path does not exist, or the path is an empty string: "+path);
|
||||||
} else if (!dir.isDirectory()) {
|
} else if (!dir.isDirectory()) {
|
||||||
setError(SFM_DIR_NOTDIR, "The given savepath is not a directory: "+path);
|
setError(SFM_DIR_NOTDIR, "The given savepath is not a directory: "+path);
|
||||||
|
@ -162,11 +162,11 @@ void DefaultSaveFileManager::checkPath(const Common::FilesystemNode &dir) {
|
||||||
|
|
||||||
Common::InSaveFile *DefaultSaveFileManager::openForLoading(const char *filename) {
|
Common::InSaveFile *DefaultSaveFileManager::openForLoading(const char *filename) {
|
||||||
// Ensure that the savepath is valid. If not, generate an appropriate error.
|
// Ensure that the savepath is valid. If not, generate an appropriate error.
|
||||||
Common::FilesystemNode savePath(getSavePath());
|
Common::FSNode savePath(getSavePath());
|
||||||
checkPath(savePath);
|
checkPath(savePath);
|
||||||
|
|
||||||
if (getError() == SFM_NO_ERROR) {
|
if (getError() == SFM_NO_ERROR) {
|
||||||
Common::FilesystemNode 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.openForReading();
|
||||||
|
@ -179,11 +179,11 @@ Common::InSaveFile *DefaultSaveFileManager::openForLoading(const char *filename)
|
||||||
|
|
||||||
Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const char *filename) {
|
Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const char *filename) {
|
||||||
// Ensure that the savepath is valid. If not, generate an appropriate error.
|
// Ensure that the savepath is valid. If not, generate an appropriate error.
|
||||||
Common::FilesystemNode savePath(getSavePath());
|
Common::FSNode savePath(getSavePath());
|
||||||
checkPath(savePath);
|
checkPath(savePath);
|
||||||
|
|
||||||
if (getError() == SFM_NO_ERROR) {
|
if (getError() == SFM_NO_ERROR) {
|
||||||
Common::FilesystemNode 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.openForWriting();
|
||||||
|
@ -197,10 +197,10 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const char *filename)
|
||||||
bool DefaultSaveFileManager::removeSavefile(const char *filename) {
|
bool DefaultSaveFileManager::removeSavefile(const char *filename) {
|
||||||
clearError();
|
clearError();
|
||||||
|
|
||||||
Common::FilesystemNode savePath(getSavePath());
|
Common::FSNode savePath(getSavePath());
|
||||||
Common::FilesystemNode file = savePath.getChild(filename);
|
Common::FSNode file = savePath.getChild(filename);
|
||||||
|
|
||||||
// TODO: Add new method FilesystemNode::remove()
|
// TODO: Add new method FSNode::remove()
|
||||||
if (remove(file.getPath().c_str()) != 0) {
|
if (remove(file.getPath().c_str()) != 0) {
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
if (errno == EACCES)
|
if (errno == EACCES)
|
||||||
|
|
|
@ -55,7 +55,7 @@ protected:
|
||||||
* Checks the given path for read access, existence, etc.
|
* Checks the given path for read access, existence, etc.
|
||||||
* Sets the internal error and error message accordingly.
|
* Sets the internal error and error message accordingly.
|
||||||
*/
|
*/
|
||||||
void checkPath(const Common::FilesystemNode &dir);
|
void checkPath(const Common::FSNode &dir);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -365,7 +365,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar
|
||||||
END_OPTION
|
END_OPTION
|
||||||
|
|
||||||
DO_OPTION('p', "path")
|
DO_OPTION('p', "path")
|
||||||
Common::FilesystemNode path(option);
|
Common::FSNode path(option);
|
||||||
if (!path.exists()) {
|
if (!path.exists()) {
|
||||||
usage("Non-existent game path '%s'", option);
|
usage("Non-existent game path '%s'", option);
|
||||||
} else if (!path.isReadable()) {
|
} else if (!path.isReadable()) {
|
||||||
|
@ -408,7 +408,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar
|
||||||
END_OPTION
|
END_OPTION
|
||||||
|
|
||||||
DO_LONG_OPTION("soundfont")
|
DO_LONG_OPTION("soundfont")
|
||||||
Common::FilesystemNode path(option);
|
Common::FSNode path(option);
|
||||||
if (!path.exists()) {
|
if (!path.exists()) {
|
||||||
usage("Non-existent soundfont path '%s'", option);
|
usage("Non-existent soundfont path '%s'", option);
|
||||||
} else if (!path.isReadable()) {
|
} else if (!path.isReadable()) {
|
||||||
|
@ -438,7 +438,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar
|
||||||
END_OPTION
|
END_OPTION
|
||||||
|
|
||||||
DO_LONG_OPTION("savepath")
|
DO_LONG_OPTION("savepath")
|
||||||
Common::FilesystemNode path(option);
|
Common::FSNode path(option);
|
||||||
if (!path.exists()) {
|
if (!path.exists()) {
|
||||||
usage("Non-existent savegames path '%s'", option);
|
usage("Non-existent savegames path '%s'", option);
|
||||||
} else if (!path.isWritable()) {
|
} else if (!path.isWritable()) {
|
||||||
|
@ -447,7 +447,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar
|
||||||
END_OPTION
|
END_OPTION
|
||||||
|
|
||||||
DO_LONG_OPTION("extrapath")
|
DO_LONG_OPTION("extrapath")
|
||||||
Common::FilesystemNode path(option);
|
Common::FSNode path(option);
|
||||||
if (!path.exists()) {
|
if (!path.exists()) {
|
||||||
usage("Non-existent extra path '%s'", option);
|
usage("Non-existent extra path '%s'", option);
|
||||||
} else if (!path.isReadable()) {
|
} else if (!path.isReadable()) {
|
||||||
|
@ -465,7 +465,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar
|
||||||
END_OPTION
|
END_OPTION
|
||||||
|
|
||||||
DO_LONG_OPTION("themepath")
|
DO_LONG_OPTION("themepath")
|
||||||
Common::FilesystemNode path(option);
|
Common::FSNode path(option);
|
||||||
if (!path.exists()) {
|
if (!path.exists()) {
|
||||||
usage("Non-existent theme path '%s'", option);
|
usage("Non-existent theme path '%s'", option);
|
||||||
} else if (!path.isReadable()) {
|
} else if (!path.isReadable()) {
|
||||||
|
@ -623,9 +623,9 @@ static void runDetectorTest() {
|
||||||
gameid = name;
|
gameid = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::FilesystemNode dir(path);
|
Common::FSNode dir(path);
|
||||||
Common::FSList files;
|
Common::FSList files;
|
||||||
if (!dir.getChildren(files, Common::FilesystemNode::kListAll)) {
|
if (!dir.getChildren(files, Common::FSNode::kListAll)) {
|
||||||
printf(" ... invalid path, skipping\n");
|
printf(" ... invalid path, skipping\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -736,7 +736,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings) {
|
||||||
if (!settings.contains("savepath")) {
|
if (!settings.contains("savepath")) {
|
||||||
const char *dir = getenv("SCUMMVM_SAVEPATH");
|
const char *dir = getenv("SCUMMVM_SAVEPATH");
|
||||||
if (dir && *dir && strlen(dir) < MAXPATHLEN) {
|
if (dir && *dir && strlen(dir) < MAXPATHLEN) {
|
||||||
Common::FilesystemNode saveDir(dir);
|
Common::FSNode saveDir(dir);
|
||||||
if (!saveDir.exists()) {
|
if (!saveDir.exists()) {
|
||||||
warning("Non-existent SCUMMVM_SAVEPATH save path. It will be ignored.");
|
warning("Non-existent SCUMMVM_SAVEPATH save path. It will be ignored.");
|
||||||
} else if (!saveDir.isWritable()) {
|
} else if (!saveDir.isWritable()) {
|
||||||
|
|
|
@ -207,8 +207,8 @@ PluginList FilePluginProvider::getPlugins() {
|
||||||
Common::FSList pluginDirs;
|
Common::FSList pluginDirs;
|
||||||
|
|
||||||
// Add the default directories
|
// Add the default directories
|
||||||
pluginDirs.push_back(Common::FilesystemNode("."));
|
pluginDirs.push_back(Common::FSNode("."));
|
||||||
pluginDirs.push_back(Common::FilesystemNode("plugins"));
|
pluginDirs.push_back(Common::FSNode("plugins"));
|
||||||
|
|
||||||
// Add the provider's custom directories
|
// Add the provider's custom directories
|
||||||
addCustomDirectories(pluginDirs);
|
addCustomDirectories(pluginDirs);
|
||||||
|
@ -216,14 +216,14 @@ PluginList FilePluginProvider::getPlugins() {
|
||||||
// Add the user specified directory
|
// Add the user specified directory
|
||||||
Common::String pluginsPath(ConfMan.get("pluginspath"));
|
Common::String pluginsPath(ConfMan.get("pluginspath"));
|
||||||
if (!pluginsPath.empty())
|
if (!pluginsPath.empty())
|
||||||
pluginDirs.push_back(Common::FilesystemNode(pluginsPath));
|
pluginDirs.push_back(Common::FSNode(pluginsPath));
|
||||||
|
|
||||||
Common::FSList::const_iterator dir;
|
Common::FSList::const_iterator dir;
|
||||||
for (dir = pluginDirs.begin(); dir != pluginDirs.end(); dir++) {
|
for (dir = pluginDirs.begin(); dir != pluginDirs.end(); dir++) {
|
||||||
// Load all plugins.
|
// Load all plugins.
|
||||||
// Scan for all plugins in this directory
|
// Scan for all plugins in this directory
|
||||||
Common::FSList files;
|
Common::FSList files;
|
||||||
if (!dir->getChildren(files, Common::FilesystemNode::kListFilesOnly)) {
|
if (!dir->getChildren(files, Common::FSNode::kListFilesOnly)) {
|
||||||
debug(1, "Couldn't open plugin directory '%s'", dir->getPath().c_str());
|
debug(1, "Couldn't open plugin directory '%s'", dir->getPath().c_str());
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
@ -240,7 +240,7 @@ PluginList FilePluginProvider::getPlugins() {
|
||||||
return pl;
|
return pl;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilePluginProvider::isPluginFilename(const Common::FilesystemNode &node) const {
|
bool FilePluginProvider::isPluginFilename(const Common::FSNode &node) const {
|
||||||
Common::String filename = node.getName();
|
Common::String filename = node.getName();
|
||||||
|
|
||||||
#ifdef PLUGIN_PREFIX
|
#ifdef PLUGIN_PREFIX
|
||||||
|
@ -260,7 +260,7 @@ bool FilePluginProvider::isPluginFilename(const Common::FilesystemNode &node) co
|
||||||
|
|
||||||
void FilePluginProvider::addCustomDirectories(Common::FSList &dirs) const {
|
void FilePluginProvider::addCustomDirectories(Common::FSList &dirs) const {
|
||||||
#ifdef PLUGIN_DIRECTORY
|
#ifdef PLUGIN_DIRECTORY
|
||||||
dirs.push_back(Common::FilesystemNode(PLUGIN_DIRECTORY));
|
dirs.push_back(Common::FSNode(PLUGIN_DIRECTORY));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
class FSList;
|
class FSList;
|
||||||
class FilesystemNode;
|
class FSNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ protected:
|
||||||
* @param node the FSNode of the loadable code module
|
* @param node the FSNode of the loadable code module
|
||||||
* @return a pointer to a Plugin instance, or 0 if an error occurred.
|
* @return a pointer to a Plugin instance, or 0 if an error occurred.
|
||||||
*/
|
*/
|
||||||
virtual Plugin *createPlugin(const Common::FilesystemNode &node) const = 0;
|
virtual Plugin *createPlugin(const Common::FSNode &node) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the supplied file corresponds to a loadable plugin file in
|
* Check if the supplied file corresponds to a loadable plugin file in
|
||||||
|
@ -251,7 +251,7 @@ protected:
|
||||||
* @param node the FSNode of the file to check
|
* @param node the FSNode of the file to check
|
||||||
* @return true if the filename corresponds to a plugin, false otherwise
|
* @return true if the filename corresponds to a plugin, false otherwise
|
||||||
*/
|
*/
|
||||||
virtual bool isPluginFilename(const Common::FilesystemNode &node) const;
|
virtual bool isPluginFilename(const Common::FSNode &node) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optionally add to the list of directories to be searched for
|
* Optionally add to the list of directories to be searched for
|
||||||
|
|
|
@ -246,9 +246,9 @@ PluginError AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) c
|
||||||
path = ".";
|
path = ".";
|
||||||
warning("No path was provided. Assuming the data files are in the current directory");
|
warning("No path was provided. Assuming the data files are in the current directory");
|
||||||
}
|
}
|
||||||
FilesystemNode dir(path);
|
FSNode dir(path);
|
||||||
FSList files;
|
FSList files;
|
||||||
if (!dir.isDirectory() || !dir.getChildren(files, FilesystemNode::kListAll)) {
|
if (!dir.isDirectory() || !dir.getChildren(files, FSNode::kListAll)) {
|
||||||
warning("Game data path does not exist or is not a directory (%s)", path.c_str());
|
warning("Game data path does not exist or is not a directory (%s)", path.c_str());
|
||||||
return kNoGameDataFoundError;
|
return kNoGameDataFoundError;
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ PluginError AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) c
|
||||||
|
|
||||||
typedef HashMap<String, bool, IgnoreCase_Hash, IgnoreCase_EqualTo> StringSet;
|
typedef HashMap<String, bool, IgnoreCase_Hash, IgnoreCase_EqualTo> StringSet;
|
||||||
typedef HashMap<String, int32, IgnoreCase_Hash, IgnoreCase_EqualTo> IntMap;
|
typedef HashMap<String, int32, IgnoreCase_Hash, IgnoreCase_EqualTo> IntMap;
|
||||||
typedef HashMap<String, FilesystemNode, IgnoreCase_Hash, IgnoreCase_EqualTo> FileMap;
|
typedef HashMap<String, FSNode, IgnoreCase_Hash, IgnoreCase_EqualTo> FileMap;
|
||||||
|
|
||||||
static void reportUnknown(const StringMap &filesMD5, const IntMap &filesSize) {
|
static void reportUnknown(const StringMap &filesMD5, const IntMap &filesSize) {
|
||||||
// TODO: This message should be cleaned up / made more specific.
|
// TODO: This message should be cleaned up / made more specific.
|
||||||
|
|
|
@ -54,7 +54,7 @@ int Archive::matchPattern(StringList &list, const String &pattern) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FSDirectory::FSDirectory(const FilesystemNode &node, int depth)
|
FSDirectory::FSDirectory(const FSNode &node, int depth)
|
||||||
: _node(node), _cached(false), _depth(depth) {
|
: _node(node), _cached(false), _depth(depth) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,11 +65,11 @@ FSDirectory::FSDirectory(const String &name, int depth)
|
||||||
FSDirectory::~FSDirectory() {
|
FSDirectory::~FSDirectory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
FilesystemNode FSDirectory::getFSNode() const {
|
FSNode FSDirectory::getFSNode() const {
|
||||||
return _node;
|
return _node;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilesystemNode FSDirectory::lookupCache(NodeCache &cache, const String &name) {
|
FSNode FSDirectory::lookupCache(NodeCache &cache, const String &name) {
|
||||||
// make caching as lazy as possible
|
// make caching as lazy as possible
|
||||||
if (!name.empty()) {
|
if (!name.empty()) {
|
||||||
if (!_cached) {
|
if (!_cached) {
|
||||||
|
@ -81,7 +81,7 @@ FilesystemNode FSDirectory::lookupCache(NodeCache &cache, const String &name) {
|
||||||
return cache[name];
|
return cache[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
return FilesystemNode();
|
return FSNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FSDirectory::hasFile(const String &name) {
|
bool FSDirectory::hasFile(const String &name) {
|
||||||
|
@ -89,7 +89,7 @@ bool FSDirectory::hasFile(const String &name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilesystemNode node = lookupCache(_fileCache, name);
|
FSNode node = lookupCache(_fileCache, name);
|
||||||
return node.exists();
|
return node.exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,13 +98,13 @@ SeekableReadStream *FSDirectory::openFile(const String &name) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilesystemNode node = lookupCache(_fileCache, name);
|
FSNode node = lookupCache(_fileCache, name);
|
||||||
|
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
warning("FSDirectory::openFile: FilesystemNode does not exist");
|
warning("FSDirectory::openFile: FSNode does not exist");
|
||||||
return 0;
|
return 0;
|
||||||
} else if (node.isDirectory()) {
|
} else if (node.isDirectory()) {
|
||||||
warning("FSDirectory::openFile: FilesystemNode is a directory");
|
warning("FSDirectory::openFile: FSNode is a directory");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,17 +121,17 @@ FSDirectory *FSDirectory::getSubDirectory(const String &name) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilesystemNode node = lookupCache(_subDirCache, name);
|
FSNode node = lookupCache(_subDirCache, name);
|
||||||
return new FSDirectory(node);
|
return new FSDirectory(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSDirectory::cacheDirectoryRecursive(FilesystemNode node, int depth, const String& prefix) {
|
void FSDirectory::cacheDirectoryRecursive(FSNode node, int depth, const String& prefix) {
|
||||||
if (depth <= 0) {
|
if (depth <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FSList list;
|
FSList list;
|
||||||
node.getChildren(list, FilesystemNode::kListAll, false);
|
node.getChildren(list, FSNode::kListAll, false);
|
||||||
|
|
||||||
FSList::iterator it = list.begin();
|
FSList::iterator it = list.begin();
|
||||||
for ( ; it != list.end(); it++) {
|
for ( ; it != list.end(); it++) {
|
||||||
|
|
|
@ -93,21 +93,21 @@ typedef SharedPtr<Archive> ArchivePtr;
|
||||||
* Searching is case-insensitive, as the main intended goal is supporting
|
* Searching is case-insensitive, as the main intended goal is supporting
|
||||||
* retrieval of game data. First case-insensitive match is returned when
|
* retrieval of game data. First case-insensitive match is returned when
|
||||||
* searching, thus making FSDirectory heavily dependant on the underlying
|
* searching, thus making FSDirectory heavily dependant on the underlying
|
||||||
* FilesystemNode implementation.
|
* FSNode implementation.
|
||||||
*/
|
*/
|
||||||
class FSDirectory : public Archive {
|
class FSDirectory : public Archive {
|
||||||
FilesystemNode _node;
|
FSNode _node;
|
||||||
|
|
||||||
// Caches are case insensitive, clashes are dealt with when creating
|
// Caches are case insensitive, clashes are dealt with when creating
|
||||||
// Key is stored in lowercase.
|
// Key is stored in lowercase.
|
||||||
typedef HashMap<String, FilesystemNode, IgnoreCase_Hash, IgnoreCase_EqualTo> NodeCache;
|
typedef HashMap<String, FSNode, IgnoreCase_Hash, IgnoreCase_EqualTo> NodeCache;
|
||||||
NodeCache _fileCache, _subDirCache;
|
NodeCache _fileCache, _subDirCache;
|
||||||
|
|
||||||
// look for a match
|
// look for a match
|
||||||
FilesystemNode lookupCache(NodeCache &cache, const String &name);
|
FSNode lookupCache(NodeCache &cache, const String &name);
|
||||||
|
|
||||||
// cache management
|
// cache management
|
||||||
void cacheDirectoryRecursive(FilesystemNode node, int depth, const String& prefix);
|
void cacheDirectoryRecursive(FSNode node, int depth, const String& prefix);
|
||||||
bool _cached;
|
bool _cached;
|
||||||
int _depth;
|
int _depth;
|
||||||
|
|
||||||
|
@ -122,14 +122,14 @@ public:
|
||||||
* Create a FSDirectory representing a tree with the specified depth. Will result in an
|
* Create a FSDirectory representing a tree with the specified depth. Will result in an
|
||||||
* unbound FSDirectory if node does not exist or is not a directory.
|
* unbound FSDirectory if node does not exist or is not a directory.
|
||||||
*/
|
*/
|
||||||
FSDirectory(const FilesystemNode &node, int depth = 1);
|
FSDirectory(const FSNode &node, int depth = 1);
|
||||||
|
|
||||||
virtual ~FSDirectory();
|
virtual ~FSDirectory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This return the underlying FSNode of the FSDirectory.
|
* This return the underlying FSNode of the FSDirectory.
|
||||||
*/
|
*/
|
||||||
FilesystemNode getFSNode() const;
|
FSNode getFSNode() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new FSDirectory pointing to a sub directory of the instance.
|
* Create a new FSDirectory pointing to a sub directory of the instance.
|
||||||
|
|
|
@ -77,7 +77,7 @@ void ConfigManager::loadDefaultConfigFile() {
|
||||||
void ConfigManager::loadConfigFile(const String &filename) {
|
void ConfigManager::loadConfigFile(const String &filename) {
|
||||||
_filename = filename;
|
_filename = filename;
|
||||||
|
|
||||||
FilesystemNode node(filename);
|
FSNode node(filename);
|
||||||
File cfg_file;
|
File cfg_file;
|
||||||
if (!cfg_file.open(node)) {
|
if (!cfg_file.open(node)) {
|
||||||
printf("Creating configuration file: %s\n", filename.c_str());
|
printf("Creating configuration file: %s\n", filename.c_str());
|
||||||
|
|
|
@ -32,20 +32,20 @@
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
void File::addDefaultDirectory(const String &directory) {
|
void File::addDefaultDirectory(const String &directory) {
|
||||||
FilesystemNode dir(directory);
|
FSNode dir(directory);
|
||||||
addDefaultDirectoryRecursive(dir, 1);
|
addDefaultDirectoryRecursive(dir, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void File::addDefaultDirectoryRecursive(const String &directory, int level) {
|
void File::addDefaultDirectoryRecursive(const String &directory, int level) {
|
||||||
FilesystemNode dir(directory);
|
FSNode dir(directory);
|
||||||
addDefaultDirectoryRecursive(dir, level);
|
addDefaultDirectoryRecursive(dir, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
void File::addDefaultDirectory(const FilesystemNode &directory) {
|
void File::addDefaultDirectory(const FSNode &directory) {
|
||||||
addDefaultDirectoryRecursive(directory, 1);
|
addDefaultDirectoryRecursive(directory, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void File::addDefaultDirectoryRecursive(const FilesystemNode &dir, int level) {
|
void File::addDefaultDirectoryRecursive(const FSNode &dir, int level) {
|
||||||
if (level <= 0 || !dir.exists() || !dir.isDirectory())
|
if (level <= 0 || !dir.exists() || !dir.isDirectory())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ bool File::open(const String &filename, Archive &archive) {
|
||||||
return open(stream, filename);
|
return open(stream, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool File::open(const FilesystemNode &node) {
|
bool File::open(const FSNode &node) {
|
||||||
assert(!_handle);
|
assert(!_handle);
|
||||||
|
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
|
@ -196,15 +196,15 @@ bool DumpFile::open(const String &filename) {
|
||||||
assert(!filename.empty());
|
assert(!filename.empty());
|
||||||
assert(!_handle);
|
assert(!_handle);
|
||||||
|
|
||||||
FilesystemNode node(filename);
|
FSNode node(filename);
|
||||||
return open(node);
|
return open(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DumpFile::open(const FilesystemNode &node) {
|
bool DumpFile::open(const FSNode &node) {
|
||||||
assert(!_handle);
|
assert(!_handle);
|
||||||
|
|
||||||
if (node.isDirectory()) {
|
if (node.isDirectory()) {
|
||||||
warning("DumpFile::open: FilesystemNode is a directory");
|
warning("DumpFile::open: FSNode is a directory");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
class FilesystemNode;
|
class FSNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: vital to document this core class properly!!! For both users and implementors
|
* TODO: vital to document this core class properly!!! For both users and implementors
|
||||||
|
@ -52,8 +52,8 @@ public:
|
||||||
static void addDefaultDirectory(const String &directory);
|
static void addDefaultDirectory(const String &directory);
|
||||||
static void addDefaultDirectoryRecursive(const String &directory, int level = 4);
|
static void addDefaultDirectoryRecursive(const String &directory, int level = 4);
|
||||||
|
|
||||||
static void addDefaultDirectory(const FilesystemNode &directory);
|
static void addDefaultDirectory(const FSNode &directory);
|
||||||
static void addDefaultDirectoryRecursive(const FilesystemNode &directory, int level = 4);
|
static void addDefaultDirectoryRecursive(const FSNode &directory, int level = 4);
|
||||||
|
|
||||||
static void resetDefaultDirectories();
|
static void resetDefaultDirectories();
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ public:
|
||||||
* @param archive the archive in which to search for the file
|
* @param archive the archive in which to search for the file
|
||||||
* @return true if file was opened successfully, false otherwise
|
* @return true if file was opened successfully, false otherwise
|
||||||
*/
|
*/
|
||||||
virtual bool open(const FilesystemNode &node);
|
virtual bool open(const FSNode &node);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to 'open' the given stream. That is, we just wrap around it, and if stream
|
* Try to 'open' the given stream. That is, we just wrap around it, and if stream
|
||||||
|
@ -161,7 +161,7 @@ public:
|
||||||
virtual ~DumpFile();
|
virtual ~DumpFile();
|
||||||
|
|
||||||
virtual bool open(const String &filename);
|
virtual bool open(const String &filename);
|
||||||
virtual bool open(const FilesystemNode &node);
|
virtual bool open(const FSNode &node);
|
||||||
|
|
||||||
virtual void close();
|
virtual void close();
|
||||||
|
|
||||||
|
|
|
@ -29,48 +29,48 @@
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
FilesystemNode::FilesystemNode() {
|
FSNode::FSNode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
FilesystemNode::FilesystemNode(AbstractFilesystemNode *realNode)
|
FSNode::FSNode(AbstractFSNode *realNode)
|
||||||
: _realNode(realNode) {
|
: _realNode(realNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FilesystemNode::FilesystemNode(const Common::String &p) {
|
FSNode::FSNode(const Common::String &p) {
|
||||||
FilesystemFactory *factory = g_system->getFilesystemFactory();
|
FilesystemFactory *factory = g_system->getFilesystemFactory();
|
||||||
AbstractFilesystemNode *tmp = 0;
|
AbstractFSNode *tmp = 0;
|
||||||
|
|
||||||
if (p.empty() || p == ".")
|
if (p.empty() || p == ".")
|
||||||
tmp = factory->makeCurrentDirectoryFileNode();
|
tmp = factory->makeCurrentDirectoryFileNode();
|
||||||
else
|
else
|
||||||
tmp = factory->makeFileNodePath(p);
|
tmp = factory->makeFileNodePath(p);
|
||||||
_realNode = Common::SharedPtr<AbstractFilesystemNode>(tmp);
|
_realNode = Common::SharedPtr<AbstractFSNode>(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilesystemNode::operator<(const FilesystemNode& node) const {
|
bool FSNode::operator<(const FSNode& node) const {
|
||||||
if (isDirectory() != node.isDirectory())
|
if (isDirectory() != node.isDirectory())
|
||||||
return isDirectory();
|
return isDirectory();
|
||||||
|
|
||||||
return getDisplayName().compareToIgnoreCase(node.getDisplayName()) < 0;
|
return getDisplayName().compareToIgnoreCase(node.getDisplayName()) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilesystemNode::exists() const {
|
bool FSNode::exists() const {
|
||||||
if (_realNode == 0)
|
if (_realNode == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return _realNode->exists();
|
return _realNode->exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
FilesystemNode FilesystemNode::getChild(const Common::String &n) const {
|
FSNode FSNode::getChild(const Common::String &n) const {
|
||||||
// If this node is invalid or not a directory, return an invalid node
|
// If this node is invalid or not a directory, return an invalid node
|
||||||
if (_realNode == 0 || !_realNode->isDirectory())
|
if (_realNode == 0 || !_realNode->isDirectory())
|
||||||
return FilesystemNode();
|
return FSNode();
|
||||||
|
|
||||||
AbstractFilesystemNode *node = _realNode->getChild(n);
|
AbstractFSNode *node = _realNode->getChild(n);
|
||||||
return FilesystemNode(node);
|
return FSNode(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilesystemNode::getChildren(FSList &fslist, ListMode mode, bool hidden) const {
|
bool FSNode::getChildren(FSList &fslist, ListMode mode, bool hidden) const {
|
||||||
if (!_realNode || !_realNode->isDirectory())
|
if (!_realNode || !_realNode->isDirectory())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -81,61 +81,61 @@ bool FilesystemNode::getChildren(FSList &fslist, ListMode mode, bool hidden) con
|
||||||
|
|
||||||
fslist.clear();
|
fslist.clear();
|
||||||
for (AbstractFSList::iterator i = tmp.begin(); i != tmp.end(); ++i) {
|
for (AbstractFSList::iterator i = tmp.begin(); i != tmp.end(); ++i) {
|
||||||
fslist.push_back(FilesystemNode(*i));
|
fslist.push_back(FSNode(*i));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::String FilesystemNode::getDisplayName() const {
|
Common::String FSNode::getDisplayName() const {
|
||||||
assert(_realNode);
|
assert(_realNode);
|
||||||
return _realNode->getDisplayName();
|
return _realNode->getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::String FilesystemNode::getName() const {
|
Common::String FSNode::getName() const {
|
||||||
assert(_realNode);
|
assert(_realNode);
|
||||||
return _realNode->getName();
|
return _realNode->getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
FilesystemNode FilesystemNode::getParent() const {
|
FSNode FSNode::getParent() const {
|
||||||
if (_realNode == 0)
|
if (_realNode == 0)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
AbstractFilesystemNode *node = _realNode->getParent();
|
AbstractFSNode *node = _realNode->getParent();
|
||||||
if (node == 0) {
|
if (node == 0) {
|
||||||
return *this;
|
return *this;
|
||||||
} else {
|
} else {
|
||||||
return FilesystemNode(node);
|
return FSNode(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::String FilesystemNode::getPath() const {
|
Common::String FSNode::getPath() const {
|
||||||
assert(_realNode);
|
assert(_realNode);
|
||||||
return _realNode->getPath();
|
return _realNode->getPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilesystemNode::isDirectory() const {
|
bool FSNode::isDirectory() const {
|
||||||
if (_realNode == 0)
|
if (_realNode == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return _realNode->isDirectory();
|
return _realNode->isDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilesystemNode::isReadable() const {
|
bool FSNode::isReadable() const {
|
||||||
if (_realNode == 0)
|
if (_realNode == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return _realNode->isReadable();
|
return _realNode->isReadable();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilesystemNode::isWritable() const {
|
bool FSNode::isWritable() const {
|
||||||
if (_realNode == 0)
|
if (_realNode == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return _realNode->isWritable();
|
return _realNode->isWritable();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilesystemNode::lookupFile(FSList &results, const Common::String &p, bool hidden, bool exhaustive, int depth) const {
|
bool FSNode::lookupFile(FSList &results, const Common::String &p, bool hidden, bool exhaustive, int depth) const {
|
||||||
if (!isDirectory())
|
if (!isDirectory())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ bool FilesystemNode::lookupFile(FSList &results, const Common::String &p, bool h
|
||||||
pattern.toUppercase();
|
pattern.toUppercase();
|
||||||
|
|
||||||
// First match all files on this level
|
// First match all files on this level
|
||||||
getChildren(children, FilesystemNode::kListAll, hidden);
|
getChildren(children, FSNode::kListAll, hidden);
|
||||||
for (FSList::iterator entry = children.begin(); entry != children.end(); ++entry) {
|
for (FSList::iterator entry = children.begin(); entry != children.end(); ++entry) {
|
||||||
if (entry->isDirectory()) {
|
if (entry->isDirectory()) {
|
||||||
if (depth != 0)
|
if (depth != 0)
|
||||||
|
@ -173,27 +173,27 @@ bool FilesystemNode::lookupFile(FSList &results, const Common::String &p, bool h
|
||||||
return !results.empty();
|
return !results.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *FilesystemNode::openForReading() const {
|
Common::SeekableReadStream *FSNode::openForReading() const {
|
||||||
if (_realNode == 0)
|
if (_realNode == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!_realNode->exists()) {
|
if (!_realNode->exists()) {
|
||||||
warning("FilesystemNode::openForReading: FilesystemNode does not exist");
|
warning("FSNode::openForReading: FSNode does not exist");
|
||||||
return false;
|
return false;
|
||||||
} else if (_realNode->isDirectory()) {
|
} else if (_realNode->isDirectory()) {
|
||||||
warning("FilesystemNode::openForReading: FilesystemNode is a directory");
|
warning("FSNode::openForReading: FSNode is a directory");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _realNode->openForReading();
|
return _realNode->openForReading();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::WriteStream *FilesystemNode::openForWriting() const {
|
Common::WriteStream *FSNode::openForWriting() const {
|
||||||
if (_realNode == 0)
|
if (_realNode == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (_realNode->isDirectory()) {
|
if (_realNode->isDirectory()) {
|
||||||
warning("FilesystemNode::openForWriting: FilesystemNode is a directory");
|
warning("FSNode::openForWriting: FSNode is a directory");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
35
common/fs.h
35
common/fs.h
|
@ -29,11 +29,11 @@
|
||||||
#include "common/ptr.h"
|
#include "common/ptr.h"
|
||||||
#include "common/str.h"
|
#include "common/str.h"
|
||||||
|
|
||||||
class AbstractFilesystemNode;
|
class AbstractFSNode;
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
class FilesystemNode;
|
class FSNode;
|
||||||
class SeekableReadStream;
|
class SeekableReadStream;
|
||||||
class WriteStream;
|
class WriteStream;
|
||||||
|
|
||||||
|
@ -42,21 +42,22 @@ class WriteStream;
|
||||||
* This is subclass instead of just a typedef so that we can use forward
|
* This is subclass instead of just a typedef so that we can use forward
|
||||||
* declarations of it in other places.
|
* declarations of it in other places.
|
||||||
*/
|
*/
|
||||||
class FSList : public Common::Array<FilesystemNode> {};
|
class FSList : public Common::Array<FSNode> {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FilesystemNode provides an abstraction for file paths, allowing for portable
|
* FSNode, short for "File System Node", provides an abstraction for file
|
||||||
* file system browsing. To this ends, multiple or single roots have to be supported
|
* paths, allowing for portable file system browsing. This means for example,
|
||||||
* (compare Unix with a single root, Windows with multiple roots C:, D:, ...).
|
* that multiple or single roots have to be supported (compare Unix with a
|
||||||
|
* single root, Windows with multiple roots C:, D:, ...).
|
||||||
*
|
*
|
||||||
* To this end, we abstract away from paths; implementations can be based on
|
* To this end, we abstract away from paths; implementations can be based on
|
||||||
* paths (and it's left to them whether / or \ or : is the path separator :-);
|
* paths (and it's left to them whether / or \ or : is the path separator :-);
|
||||||
* but it is also possible to use inodes or vrefs (MacOS 9) or anything else.
|
* but it is also possible to use inodes or vrefs (MacOS 9) or anything else.
|
||||||
*/
|
*/
|
||||||
class FilesystemNode {
|
class FSNode {
|
||||||
private:
|
private:
|
||||||
Common::SharedPtr<AbstractFilesystemNode> _realNode;
|
Common::SharedPtr<AbstractFSNode> _realNode;
|
||||||
FilesystemNode(AbstractFilesystemNode *realNode);
|
FSNode(AbstractFSNode *realNode);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -69,14 +70,14 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new pathless FilesystemNode. Since there's no path associated
|
* Create a new pathless FSNode. Since there's no path associated
|
||||||
* with this node, path-related operations (i.e. exists(), isDirectory(),
|
* with this node, path-related operations (i.e. exists(), isDirectory(),
|
||||||
* getPath()) will always return false or raise an assertion.
|
* getPath()) will always return false or raise an assertion.
|
||||||
*/
|
*/
|
||||||
FilesystemNode();
|
FSNode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new FilesystemNode referring to the specified path. This is
|
* Create a new FSNode referring to the specified path. This is
|
||||||
* the counterpart to the path() method.
|
* the counterpart to the path() method.
|
||||||
*
|
*
|
||||||
* If path is empty or equals ".", then a node representing the "current
|
* If path is empty or equals ".", then a node representing the "current
|
||||||
|
@ -84,15 +85,15 @@ public:
|
||||||
* operating system doesn't support the concept), some other directory is
|
* operating system doesn't support the concept), some other directory is
|
||||||
* used (usually the root directory).
|
* used (usually the root directory).
|
||||||
*/
|
*/
|
||||||
explicit FilesystemNode(const Common::String &path);
|
explicit FSNode(const Common::String &path);
|
||||||
|
|
||||||
virtual ~FilesystemNode() {}
|
virtual ~FSNode() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare the name of this node to the name of another. Directories
|
* Compare the name of this node to the name of another. Directories
|
||||||
* go before normal files.
|
* go before normal files.
|
||||||
*/
|
*/
|
||||||
bool operator<(const FilesystemNode& node) const;
|
bool operator<(const FSNode& node) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the object referred by this node exists in the filesystem or not.
|
* Indicates whether the object referred by this node exists in the filesystem or not.
|
||||||
|
@ -118,7 +119,7 @@ public:
|
||||||
* @param name the name of a child of this directory
|
* @param name the name of a child of this directory
|
||||||
* @return the node referring to the child with the given name
|
* @return the node referring to the child with the given name
|
||||||
*/
|
*/
|
||||||
FilesystemNode getChild(const Common::String &name) const;
|
FSNode getChild(const Common::String &name) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a list of all child nodes of this directory node. If called on a node
|
* Return a list of all child nodes of this directory node. If called on a node
|
||||||
|
@ -165,7 +166,7 @@ public:
|
||||||
* Get the parent node of this node. If this node has no parent node,
|
* Get the parent node of this node. If this node has no parent node,
|
||||||
* then it returns a duplicate of this node.
|
* then it returns a duplicate of this node.
|
||||||
*/
|
*/
|
||||||
FilesystemNode getParent() const;
|
FSNode getParent() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the node refers to a directory or not.
|
* Indicates whether the node refers to a directory or not.
|
||||||
|
|
|
@ -246,15 +246,15 @@ void md5_finish(md5_context *ctx, uint8 digest[16]) {
|
||||||
PUT_UINT32(ctx->state[3], digest, 12);
|
PUT_UINT32(ctx->state[3], digest, 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool md5_file(const FilesystemNode &file, uint8 digest[16], uint32 length) {
|
bool md5_file(const FSNode &file, uint8 digest[16], uint32 length) {
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
warning("md5_file: using an inexistent FilesystemNode");
|
warning("md5_file: using an inexistent FSNode");
|
||||||
return false;
|
return false;
|
||||||
} else if (!file.isReadable()) {
|
} else if (!file.isReadable()) {
|
||||||
warning("md5_file: using an unreadable FilesystemNode");
|
warning("md5_file: using an unreadable FSNode");
|
||||||
return false;
|
return false;
|
||||||
} else if (file.isDirectory()) {
|
} else if (file.isDirectory()) {
|
||||||
warning("md5_file: using a directory FilesystemNode");
|
warning("md5_file: using a directory FSNode");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ bool md5_file(ReadStream &stream, uint8 digest[16], uint32 length) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool md5_file_string(const FilesystemNode &file, char *md5str, uint32 length) {
|
bool md5_file_string(const FSNode &file, char *md5str, uint32 length) {
|
||||||
uint8 digest[16];
|
uint8 digest[16];
|
||||||
if (!md5_file(file, digest, length))
|
if (!md5_file(file, digest, length))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
class FilesystemNode;
|
class FSNode;
|
||||||
class ReadStream;
|
class ReadStream;
|
||||||
|
|
||||||
bool md5_file(const char *name, uint8 digest[16], uint32 length = 0);
|
bool md5_file(const char *name, uint8 digest[16], uint32 length = 0);
|
||||||
bool md5_file(const FilesystemNode &file, uint8 digest[16], uint32 length = 0);
|
bool md5_file(const FSNode &file, uint8 digest[16], uint32 length = 0);
|
||||||
bool md5_file(ReadStream &stream, uint8 digest[16], uint32 length = 0);
|
bool md5_file(ReadStream &stream, uint8 digest[16], uint32 length = 0);
|
||||||
|
|
||||||
// The following two methods work similar to the above two, but
|
// The following two methods work similar to the above two, but
|
||||||
|
@ -41,7 +41,7 @@ bool md5_file(ReadStream &stream, uint8 digest[16], uint32 length = 0);
|
||||||
// a human readable lowercase hexstring representing the digest.
|
// a human readable lowercase hexstring representing the digest.
|
||||||
// The md5str parameter must point to a buffer of 32+1 chars.
|
// The md5str parameter must point to a buffer of 32+1 chars.
|
||||||
bool md5_file_string(const char *name, char *md5str, uint32 length = 0);
|
bool md5_file_string(const char *name, char *md5str, uint32 length = 0);
|
||||||
bool md5_file_string(const FilesystemNode &file, char *md5str, uint32 length = 0);
|
bool md5_file_string(const FSNode &file, char *md5str, uint32 length = 0);
|
||||||
bool md5_file_string(ReadStream &stream, char *md5str, uint32 length = 0);
|
bool md5_file_string(ReadStream &stream, char *md5str, uint32 length = 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ static Common::String getDefaultConfigFileName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *OSystem::openConfigFileForReading() {
|
Common::SeekableReadStream *OSystem::openConfigFileForReading() {
|
||||||
Common::FilesystemNode file(getDefaultConfigFileName());
|
Common::FSNode file(getDefaultConfigFileName());
|
||||||
return file.openForReading();
|
return file.openForReading();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ Common::WriteStream *OSystem::openConfigFileForWriting() {
|
||||||
#ifdef __DC__
|
#ifdef __DC__
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
Common::FilesystemNode file(getDefaultConfigFileName());
|
Common::FSNode file(getDefaultConfigFileName());
|
||||||
return file.openForWriting();
|
return file.openForWriting();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -1363,7 +1363,7 @@ class ZipArchiveMember : public ArchiveMember {
|
||||||
unzFile _zipFile;
|
unzFile _zipFile;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ZipArchiveMember(FilesystemNode &node) : _node(node) {
|
ZipArchiveMember(FSNode &node) : _node(node) {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getName() const {
|
String getName() const {
|
||||||
|
|
|
@ -2207,7 +2207,7 @@ const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const Common::FSL
|
||||||
bool matchedUsingWag = false;
|
bool matchedUsingWag = false;
|
||||||
int wagFileCount = 0;
|
int wagFileCount = 0;
|
||||||
WagFileParser wagFileParser;
|
WagFileParser wagFileParser;
|
||||||
Common::FilesystemNode wagFileNode;
|
Common::FSNode wagFileNode;
|
||||||
Common::String description;
|
Common::String description;
|
||||||
Common::FSList fslistCurrentDir; // Only used if fslist == NULL
|
Common::FSList fslistCurrentDir; // Only used if fslist == NULL
|
||||||
|
|
||||||
|
@ -2222,8 +2222,8 @@ const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const Common::FSL
|
||||||
if (path.empty())
|
if (path.empty())
|
||||||
path = ".";
|
path = ".";
|
||||||
|
|
||||||
Common::FilesystemNode fsCurrentDir(path);
|
Common::FSNode fsCurrentDir(path);
|
||||||
fsCurrentDir.getChildren(fslistCurrentDir, Common::FilesystemNode::kListFilesOnly);
|
fsCurrentDir.getChildren(fslistCurrentDir, Common::FSNode::kListFilesOnly);
|
||||||
fslist = &fslistCurrentDir;
|
fslist = &fslistCurrentDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,9 +48,9 @@ int AgiLoader_v3::detectGame() {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
Common::FSList fslist;
|
Common::FSList fslist;
|
||||||
Common::FilesystemNode dir(ConfMan.get("path"));
|
Common::FSNode dir(ConfMan.get("path"));
|
||||||
|
|
||||||
if (!dir.getChildren(fslist, Common::FilesystemNode::kListFilesOnly)) {
|
if (!dir.getChildren(fslist, Common::FSNode::kListFilesOnly)) {
|
||||||
warning("AgiEngine: invalid game path '%s'", dir.getPath().c_str());
|
warning("AgiEngine: invalid game path '%s'", dir.getPath().c_str());
|
||||||
return errInvalidAGIFile;
|
return errInvalidAGIFile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1007,7 +1007,7 @@ const IIgsExeInfo *SoundMgr::getIIgsExeInfo(enum AgiGameID gameid) const {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IIgsSoundMgr::loadInstrumentHeaders(const Common::FilesystemNode &exePath, const IIgsExeInfo &exeInfo) {
|
bool IIgsSoundMgr::loadInstrumentHeaders(const Common::FSNode &exePath, const IIgsExeInfo &exeInfo) {
|
||||||
bool loadedOk = false; // Was loading successful?
|
bool loadedOk = false; // Was loading successful?
|
||||||
Common::File file;
|
Common::File file;
|
||||||
|
|
||||||
|
@ -1078,7 +1078,7 @@ bool SoundMgr::convertWave(Common::SeekableReadStream &source, int8 *dest, uint
|
||||||
return !source.ioFailed();
|
return !source.ioFailed();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IIgsSoundMgr::loadWaveFile(const Common::FilesystemNode &wavePath, const IIgsExeInfo &exeInfo) {
|
bool IIgsSoundMgr::loadWaveFile(const Common::FSNode &wavePath, const IIgsExeInfo &exeInfo) {
|
||||||
Common::File file;
|
Common::File file;
|
||||||
|
|
||||||
// Open the wave file and read it into memory
|
// Open the wave file and read it into memory
|
||||||
|
@ -1107,14 +1107,14 @@ bool IIgsSoundMgr::loadWaveFile(const Common::FilesystemNode &wavePath, const II
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function object (i.e. a functor) for testing if a Common::FilesystemNode
|
* A function object (i.e. a functor) for testing if a Common::FSNode
|
||||||
* object's name is equal (Ignoring case) to a string or to at least
|
* object's name is equal (Ignoring case) to a string or to at least
|
||||||
* one of the strings in a list of strings. Can be used e.g. with find_if().
|
* one of the strings in a list of strings. Can be used e.g. with find_if().
|
||||||
*/
|
*/
|
||||||
struct fsnodeNameEqualsIgnoreCase : public Common::UnaryFunction<const Common::FilesystemNode&, bool> {
|
struct fsnodeNameEqualsIgnoreCase : public Common::UnaryFunction<const Common::FSNode&, bool> {
|
||||||
fsnodeNameEqualsIgnoreCase(const Common::StringList &str) : _str(str) {}
|
fsnodeNameEqualsIgnoreCase(const Common::StringList &str) : _str(str) {}
|
||||||
fsnodeNameEqualsIgnoreCase(const Common::String str) { _str.push_back(str); }
|
fsnodeNameEqualsIgnoreCase(const Common::String str) { _str.push_back(str); }
|
||||||
bool operator()(const Common::FilesystemNode ¶m) const {
|
bool operator()(const Common::FSNode ¶m) const {
|
||||||
for (Common::StringList::const_iterator iter = _str.begin(); iter != _str.end(); iter++)
|
for (Common::StringList::const_iterator iter = _str.begin(); iter != _str.end(); iter++)
|
||||||
if (param.getName().equalsIgnoreCase(*iter))
|
if (param.getName().equalsIgnoreCase(*iter))
|
||||||
return true;
|
return true;
|
||||||
|
@ -1140,8 +1140,8 @@ bool SoundMgr::loadInstruments() {
|
||||||
|
|
||||||
// List files in the game path
|
// List files in the game path
|
||||||
Common::FSList fslist;
|
Common::FSList fslist;
|
||||||
Common::FilesystemNode dir(ConfMan.get("path"));
|
Common::FSNode dir(ConfMan.get("path"));
|
||||||
if (!dir.getChildren(fslist, Common::FilesystemNode::kListFilesOnly)) {
|
if (!dir.getChildren(fslist, Common::FSNode::kListFilesOnly)) {
|
||||||
warning("Invalid game path (\"%s\"), not loading Apple IIGS instruments", dir.getPath().c_str());
|
warning("Invalid game path (\"%s\"), not loading Apple IIGS instruments", dir.getPath().c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -402,8 +402,8 @@ public:
|
||||||
// For initializing
|
// For initializing
|
||||||
IIgsSoundMgr();
|
IIgsSoundMgr();
|
||||||
void setProgramChangeMapping(const MidiProgramChangeMapping *mapping);
|
void setProgramChangeMapping(const MidiProgramChangeMapping *mapping);
|
||||||
bool loadInstrumentHeaders(const Common::FilesystemNode &exePath, const IIgsExeInfo &exeInfo);
|
bool loadInstrumentHeaders(const Common::FSNode &exePath, const IIgsExeInfo &exeInfo);
|
||||||
bool loadWaveFile(const Common::FilesystemNode &wavePath, const IIgsExeInfo &exeInfo);
|
bool loadWaveFile(const Common::FSNode &wavePath, const IIgsExeInfo &exeInfo);
|
||||||
// Miscellaneous methods
|
// Miscellaneous methods
|
||||||
uint activeSounds() const; ///< How many active sounds are playing?
|
uint activeSounds() const; ///< How many active sounds are playing?
|
||||||
void stopSounds(); ///< Stops all sounds
|
void stopSounds(); ///< Stops all sounds
|
||||||
|
|
|
@ -173,7 +173,7 @@ bool WagFileParser::checkWagVersion(Common::SeekableReadStream &stream) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WagFileParser::parse(const Common::FilesystemNode &node) {
|
bool WagFileParser::parse(const Common::FSNode &node) {
|
||||||
WagProperty property; // Temporary property used for reading
|
WagProperty property; // Temporary property used for reading
|
||||||
Common::SeekableReadStream *stream = NULL; // The file stream
|
Common::SeekableReadStream *stream = NULL; // The file stream
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ public:
|
||||||
* @param filename Name of the file to be parsed.
|
* @param filename Name of the file to be parsed.
|
||||||
* @return True if parsed successfully, false otherwise.
|
* @return True if parsed successfully, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool parse(const Common::FilesystemNode &node);
|
bool parse(const Common::FSNode &node);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get list of the loaded properties.
|
* Get list of the loaded properties.
|
||||||
|
|
|
@ -62,7 +62,7 @@ protected:
|
||||||
|
|
||||||
const Common::String _targetName; // target name for saves
|
const Common::String _targetName; // target name for saves
|
||||||
|
|
||||||
const Common::FilesystemNode _gameDataDir;
|
const Common::FSNode _gameDataDir;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -57,7 +57,7 @@ Resource::~Resource() {
|
||||||
bool Resource::reset() {
|
bool Resource::reset() {
|
||||||
unloadAllPakFiles();
|
unloadAllPakFiles();
|
||||||
|
|
||||||
Common::FilesystemNode dir(ConfMan.get("path"));
|
Common::FSNode dir(ConfMan.get("path"));
|
||||||
|
|
||||||
if (!dir.exists() || !dir.isDirectory())
|
if (!dir.exists() || !dir.isDirectory())
|
||||||
error("invalid game path '%s'", dir.getPath().c_str());
|
error("invalid game path '%s'", dir.getPath().c_str());
|
||||||
|
@ -103,7 +103,7 @@ bool Resource::reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::FSList fslist;
|
Common::FSList fslist;
|
||||||
if (!dir.getChildren(fslist, Common::FilesystemNode::kListFilesOnly))
|
if (!dir.getChildren(fslist, Common::FSNode::kListFilesOnly))
|
||||||
error("can't list files inside game path '%s'", dir.getPath().c_str());
|
error("can't list files inside game path '%s'", dir.getPath().c_str());
|
||||||
|
|
||||||
if (_vm->game() == GI_KYRA1 && _vm->gameFlags().isTalkie) {
|
if (_vm->game() == GI_KYRA1 && _vm->gameFlags().isTalkie) {
|
||||||
|
|
|
@ -211,21 +211,21 @@ protected:
|
||||||
|
|
||||||
Parallaction *_vm;
|
Parallaction *_vm;
|
||||||
|
|
||||||
Common::FilesystemNode _baseDir;
|
Common::FSNode _baseDir;
|
||||||
Common::FilesystemNode _partDir;
|
Common::FSNode _partDir;
|
||||||
|
|
||||||
Common::FilesystemNode _aniDir;
|
Common::FSNode _aniDir;
|
||||||
Common::FilesystemNode _bkgDir;
|
Common::FSNode _bkgDir;
|
||||||
Common::FilesystemNode _mscDir;
|
Common::FSNode _mscDir;
|
||||||
Common::FilesystemNode _mskDir;
|
Common::FSNode _mskDir;
|
||||||
Common::FilesystemNode _pthDir;
|
Common::FSNode _pthDir;
|
||||||
Common::FilesystemNode _rasDir;
|
Common::FSNode _rasDir;
|
||||||
Common::FilesystemNode _scrDir;
|
Common::FSNode _scrDir;
|
||||||
Common::FilesystemNode _sfxDir;
|
Common::FSNode _sfxDir;
|
||||||
Common::FilesystemNode _talDir;
|
Common::FSNode _talDir;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void errorFileNotFound(const Common::FilesystemNode &dir, const Common::String &filename);
|
void errorFileNotFound(const Common::FSNode &dir, const Common::String &filename);
|
||||||
Font *createFont(const char *name, Common::ReadStream &stream);
|
Font *createFont(const char *name, Common::ReadStream &stream);
|
||||||
Sprites* createSprites(Common::ReadStream &stream);
|
Sprites* createSprites(Common::ReadStream &stream);
|
||||||
void loadBitmap(Common::SeekableReadStream &stream, Graphics::Surface &surf, byte *palette);
|
void loadBitmap(Common::SeekableReadStream &stream, Graphics::Surface &surf, byte *palette);
|
||||||
|
@ -273,14 +273,14 @@ protected:
|
||||||
Font *createFont(const char *name, Common::SeekableReadStream &stream);
|
Font *createFont(const char *name, Common::SeekableReadStream &stream);
|
||||||
void loadBackground(BackgroundInfo& info, Common::SeekableReadStream &stream);
|
void loadBackground(BackgroundInfo& info, Common::SeekableReadStream &stream);
|
||||||
|
|
||||||
Common::FilesystemNode _baseBkgDir;
|
Common::FSNode _baseBkgDir;
|
||||||
Common::FilesystemNode _fntDir;
|
Common::FSNode _fntDir;
|
||||||
Common::FilesystemNode _commonAniDir;
|
Common::FSNode _commonAniDir;
|
||||||
Common::FilesystemNode _commonBkgDir;
|
Common::FSNode _commonBkgDir;
|
||||||
Common::FilesystemNode _commonMscDir;
|
Common::FSNode _commonMscDir;
|
||||||
Common::FilesystemNode _commonMskDir;
|
Common::FSNode _commonMskDir;
|
||||||
Common::FilesystemNode _commonPthDir;
|
Common::FSNode _commonPthDir;
|
||||||
Common::FilesystemNode _commonTalDir;
|
Common::FSNode _commonTalDir;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AmigaDisk_br(Parallaction *vm);
|
AmigaDisk_br(Parallaction *vm);
|
||||||
|
|
|
@ -91,7 +91,7 @@ struct Sprites : public Frames {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void DosDisk_br::errorFileNotFound(const Common::FilesystemNode &dir, const Common::String &filename) {
|
void DosDisk_br::errorFileNotFound(const Common::FSNode &dir, const Common::String &filename) {
|
||||||
error("File '%s' not found in directory '%s'", filename.c_str(), dir.getDisplayName().c_str());
|
error("File '%s' not found in directory '%s'", filename.c_str(), dir.getDisplayName().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ GfxObj* DosDisk_br::loadTalk(const char *name) {
|
||||||
debugC(5, kDebugDisk, "DosDisk_br::loadTalk(%s)", name);
|
debugC(5, kDebugDisk, "DosDisk_br::loadTalk(%s)", name);
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
Common::FilesystemNode node = _talDir.getChild(path);
|
Common::FSNode node = _talDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
path += ".tal";
|
path += ".tal";
|
||||||
node = _talDir.getChild(path);
|
node = _talDir.getChild(path);
|
||||||
|
@ -160,11 +160,11 @@ Script* DosDisk_br::loadLocation(const char *name) {
|
||||||
debugC(5, kDebugDisk, "DosDisk_br::loadLocation");
|
debugC(5, kDebugDisk, "DosDisk_br::loadLocation");
|
||||||
|
|
||||||
Common::String langs[4] = { "it", "fr", "en", "ge" };
|
Common::String langs[4] = { "it", "fr", "en", "ge" };
|
||||||
Common::FilesystemNode locDir = _partDir.getChild(langs[_language]);
|
Common::FSNode locDir = _partDir.getChild(langs[_language]);
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
path += ".slf";
|
path += ".slf";
|
||||||
Common::FilesystemNode node = locDir.getChild(path);
|
Common::FSNode node = locDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
path = Common::String(name) + ".loc";
|
path = Common::String(name) + ".loc";
|
||||||
node = locDir.getChild(path);
|
node = locDir.getChild(path);
|
||||||
|
@ -183,7 +183,7 @@ Script* DosDisk_br::loadScript(const char* name) {
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
path += ".scr";
|
path += ".scr";
|
||||||
Common::FilesystemNode node = _scrDir.getChild(path);
|
Common::FSNode node = _scrDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
errorFileNotFound(_scrDir, path);
|
errorFileNotFound(_scrDir, path);
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ Frames* DosDisk_br::loadPointer(const char *name) {
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
path += ".ras";
|
path += ".ras";
|
||||||
Common::FilesystemNode node = _baseDir.getChild(path);
|
Common::FSNode node = _baseDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
errorFileNotFound(_baseDir, path);
|
errorFileNotFound(_baseDir, path);
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ Font* DosDisk_br::loadFont(const char* name) {
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
path += ".fnt";
|
path += ".fnt";
|
||||||
Common::FilesystemNode node = _baseDir.getChild(path);
|
Common::FSNode node = _baseDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
errorFileNotFound(_baseDir, path);
|
errorFileNotFound(_baseDir, path);
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ GfxObj* DosDisk_br::loadObjects(const char *name) {
|
||||||
debugC(5, kDebugDisk, "DosDisk_br::loadObjects");
|
debugC(5, kDebugDisk, "DosDisk_br::loadObjects");
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
Common::FilesystemNode node = _partDir.getChild(path);
|
Common::FSNode node = _partDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
errorFileNotFound(_partDir, path);
|
errorFileNotFound(_partDir, path);
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ GfxObj* DosDisk_br::loadStatic(const char* name) {
|
||||||
debugC(5, kDebugDisk, "DosDisk_br::loadStatic");
|
debugC(5, kDebugDisk, "DosDisk_br::loadStatic");
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
Common::FilesystemNode node = _rasDir.getChild(path);
|
Common::FSNode node = _rasDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
errorFileNotFound(_rasDir, path);
|
errorFileNotFound(_rasDir, path);
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ Frames* DosDisk_br::loadFrames(const char* name) {
|
||||||
debugC(5, kDebugDisk, "DosDisk_br::loadFrames");
|
debugC(5, kDebugDisk, "DosDisk_br::loadFrames");
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
Common::FilesystemNode node = _aniDir.getChild(path);
|
Common::FSNode node = _aniDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
path += ".ani";
|
path += ".ani";
|
||||||
node = _aniDir.getChild(path);
|
node = _aniDir.getChild(path);
|
||||||
|
@ -336,7 +336,7 @@ void DosDisk_br::loadSlide(BackgroundInfo& info, const char *name) {
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
path += ".bmp";
|
path += ".bmp";
|
||||||
Common::FilesystemNode node = _baseDir.getChild(path);
|
Common::FSNode node = _baseDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
errorFileNotFound(_baseDir, path);
|
errorFileNotFound(_baseDir, path);
|
||||||
}
|
}
|
||||||
|
@ -363,7 +363,7 @@ void DosDisk_br::loadMask(const char *name, MaskBuffer &buffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::String filepath;
|
Common::String filepath;
|
||||||
Common::FilesystemNode node;
|
Common::FSNode node;
|
||||||
Common::File stream;
|
Common::File stream;
|
||||||
|
|
||||||
filepath = Common::String(name) + ".msk";
|
filepath = Common::String(name) + ".msk";
|
||||||
|
@ -384,7 +384,7 @@ void DosDisk_br::loadScenery(BackgroundInfo& info, const char *name, const char
|
||||||
debugC(5, kDebugDisk, "DosDisk_br::loadScenery");
|
debugC(5, kDebugDisk, "DosDisk_br::loadScenery");
|
||||||
|
|
||||||
Common::String filepath;
|
Common::String filepath;
|
||||||
Common::FilesystemNode node;
|
Common::FSNode node;
|
||||||
Common::File stream;
|
Common::File stream;
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
|
@ -447,7 +447,7 @@ Table* DosDisk_br::loadTable(const char* name) {
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
path += ".tab";
|
path += ".tab";
|
||||||
Common::FilesystemNode node = _partDir.getChild(path);
|
Common::FSNode node = _partDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
errorFileNotFound(_partDir, path);
|
errorFileNotFound(_partDir, path);
|
||||||
}
|
}
|
||||||
|
@ -518,7 +518,7 @@ AmigaDisk_br::AmigaDisk_br(Parallaction *vm) : DosDisk_br(vm) {
|
||||||
|
|
||||||
_baseBkgDir = _baseDir.getChild("backs");
|
_baseBkgDir = _baseDir.getChild("backs");
|
||||||
|
|
||||||
Common::FilesystemNode commonDir = _baseDir.getChild("common");
|
Common::FSNode commonDir = _baseDir.getChild("common");
|
||||||
_commonAniDir = commonDir.getChild("anims");
|
_commonAniDir = commonDir.getChild("anims");
|
||||||
_commonBkgDir = commonDir.getChild("backs");
|
_commonBkgDir = commonDir.getChild("backs");
|
||||||
_commonMscDir = commonDir.getChild("msc");
|
_commonMscDir = commonDir.getChild("msc");
|
||||||
|
@ -566,7 +566,7 @@ void AmigaDisk_br::loadScenery(BackgroundInfo& info, const char* name, const cha
|
||||||
debugC(1, kDebugDisk, "AmigaDisk_br::loadScenery '%s', '%s' '%s'", name, mask, path);
|
debugC(1, kDebugDisk, "AmigaDisk_br::loadScenery '%s', '%s' '%s'", name, mask, path);
|
||||||
|
|
||||||
Common::String filepath;
|
Common::String filepath;
|
||||||
Common::FilesystemNode node;
|
Common::FSNode node;
|
||||||
Common::File stream;
|
Common::File stream;
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
|
@ -630,7 +630,7 @@ void AmigaDisk_br::loadSlide(BackgroundInfo& info, const char *name) {
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
path += ".bkg";
|
path += ".bkg";
|
||||||
Common::FilesystemNode node = _baseBkgDir.getChild(path);
|
Common::FSNode node = _baseBkgDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
errorFileNotFound(_baseBkgDir, path);
|
errorFileNotFound(_baseBkgDir, path);
|
||||||
}
|
}
|
||||||
|
@ -644,7 +644,7 @@ GfxObj* AmigaDisk_br::loadStatic(const char* name) {
|
||||||
debugC(1, kDebugDisk, "AmigaDisk_br::loadStatic '%s'", name);
|
debugC(1, kDebugDisk, "AmigaDisk_br::loadStatic '%s'", name);
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
Common::FilesystemNode node = _rasDir.getChild(path);
|
Common::FSNode node = _rasDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
errorFileNotFound(_rasDir, path);
|
errorFileNotFound(_rasDir, path);
|
||||||
}
|
}
|
||||||
|
@ -687,7 +687,7 @@ Frames* AmigaDisk_br::loadFrames(const char* name) {
|
||||||
debugC(1, kDebugDisk, "AmigaDisk_br::loadFrames '%s'", name);
|
debugC(1, kDebugDisk, "AmigaDisk_br::loadFrames '%s'", name);
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
Common::FilesystemNode node = _aniDir.getChild(path);
|
Common::FSNode node = _aniDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
path += ".ani";
|
path += ".ani";
|
||||||
node = _aniDir.getChild(path);
|
node = _aniDir.getChild(path);
|
||||||
|
@ -713,7 +713,7 @@ GfxObj* AmigaDisk_br::loadTalk(const char *name) {
|
||||||
debugC(1, kDebugDisk, "AmigaDisk_br::loadTalk '%s'", name);
|
debugC(1, kDebugDisk, "AmigaDisk_br::loadTalk '%s'", name);
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
Common::FilesystemNode node = _talDir.getChild(path);
|
Common::FSNode node = _talDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
path += ".tal";
|
path += ".tal";
|
||||||
node = _talDir.getChild(path);
|
node = _talDir.getChild(path);
|
||||||
|
@ -740,7 +740,7 @@ Font* AmigaDisk_br::loadFont(const char* name) {
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
path += ".font";
|
path += ".font";
|
||||||
Common::FilesystemNode node = _fntDir.getChild(path);
|
Common::FSNode node = _fntDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
errorFileNotFound(_fntDir, path);
|
errorFileNotFound(_fntDir, path);
|
||||||
}
|
}
|
||||||
|
@ -773,7 +773,7 @@ Common::SeekableReadStream* AmigaDisk_br::loadMusic(const char* name) {
|
||||||
debugC(5, kDebugDisk, "AmigaDisk_br::loadMusic");
|
debugC(5, kDebugDisk, "AmigaDisk_br::loadMusic");
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
Common::FilesystemNode node = _mscDir.getChild(path);
|
Common::FSNode node = _mscDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
// TODO (Kirben): error out when music file is not found?
|
// TODO (Kirben): error out when music file is not found?
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -789,7 +789,7 @@ Common::ReadStream* AmigaDisk_br::loadSound(const char* name) {
|
||||||
debugC(5, kDebugDisk, "AmigaDisk_br::loadSound");
|
debugC(5, kDebugDisk, "AmigaDisk_br::loadSound");
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
Common::FilesystemNode node = _sfxDir.getChild(path);
|
Common::FSNode node = _sfxDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
errorFileNotFound(_sfxDir, path);
|
errorFileNotFound(_sfxDir, path);
|
||||||
}
|
}
|
||||||
|
@ -803,7 +803,7 @@ GfxObj* AmigaDisk_br::loadObjects(const char *name) {
|
||||||
debugC(5, kDebugDisk, "AmigaDisk_br::loadObjects");
|
debugC(5, kDebugDisk, "AmigaDisk_br::loadObjects");
|
||||||
|
|
||||||
Common::String path(name);
|
Common::String path(name);
|
||||||
Common::FilesystemNode node = _partDir.getChild(path);
|
Common::FSNode node = _partDir.getChild(path);
|
||||||
if (!node.exists()) {
|
if (!node.exists()) {
|
||||||
errorFileNotFound(_partDir, path);
|
errorFileNotFound(_partDir, path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,7 @@ static Common::String generateFilenameForDetection(const char *pattern, Filename
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DetectorDesc {
|
struct DetectorDesc {
|
||||||
Common::FilesystemNode node;
|
Common::FSNode node;
|
||||||
Common::String md5;
|
Common::String md5;
|
||||||
const MD5Table *md5Entry; // Entry of the md5 table corresponding to this file, if any.
|
const MD5Table *md5Entry; // Entry of the md5 table corresponding to this file, if any.
|
||||||
};
|
};
|
||||||
|
@ -192,7 +192,7 @@ static bool testGame(const GameSettings *g, const DescMap &fileMD5Map, const Com
|
||||||
// when performing the matching. The first match is returned, so if you
|
// when performing the matching. The first match is returned, so if you
|
||||||
// search for "resource" and two nodes "RESOURE and "resource" are present,
|
// search for "resource" and two nodes "RESOURE and "resource" are present,
|
||||||
// the first match is used.
|
// the first match is used.
|
||||||
static bool searchFSNode(const Common::FSList &fslist, const Common::String &name, Common::FilesystemNode &result) {
|
static bool searchFSNode(const Common::FSList &fslist, const Common::String &name, Common::FSNode &result) {
|
||||||
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
||||||
if (!scumm_stricmp(file->getName().c_str(), name.c_str())) {
|
if (!scumm_stricmp(file->getName().c_str(), name.c_str())) {
|
||||||
result = *file;
|
result = *file;
|
||||||
|
@ -213,16 +213,16 @@ static Common::Language detectLanguage(const Common::FSList &fslist, byte id) {
|
||||||
// switch to MD5 based detection).
|
// switch to MD5 based detection).
|
||||||
const char *filename = (id == GID_CMI) ? "LANGUAGE.TAB" : "LANGUAGE.BND";
|
const char *filename = (id == GID_CMI) ? "LANGUAGE.TAB" : "LANGUAGE.BND";
|
||||||
Common::FilePtr tmp;
|
Common::FilePtr tmp;
|
||||||
Common::FilesystemNode langFile;
|
Common::FSNode langFile;
|
||||||
if (searchFSNode(fslist, filename, langFile))
|
if (searchFSNode(fslist, filename, langFile))
|
||||||
tmp = Common::FilePtr(langFile.openForReading());
|
tmp = Common::FilePtr(langFile.openForReading());
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
// try loading in RESOURCE sub dir...
|
// try loading in RESOURCE sub dir...
|
||||||
Common::FilesystemNode resDir;
|
Common::FSNode resDir;
|
||||||
Common::FSList tmpList;
|
Common::FSList tmpList;
|
||||||
if (searchFSNode(fslist, "RESOURCE", resDir)
|
if (searchFSNode(fslist, "RESOURCE", resDir)
|
||||||
&& resDir.isDirectory()
|
&& resDir.isDirectory()
|
||||||
&& resDir.getChildren(tmpList, Common::FilesystemNode::kListFilesOnly)
|
&& resDir.getChildren(tmpList, Common::FSNode::kListFilesOnly)
|
||||||
&& searchFSNode(tmpList, filename, langFile)) {
|
&& searchFSNode(tmpList, filename, langFile)) {
|
||||||
tmp = Common::FilePtr(langFile.openForReading());
|
tmp = Common::FilePtr(langFile.openForReading());
|
||||||
}
|
}
|
||||||
|
@ -787,8 +787,8 @@ PluginError ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) cons
|
||||||
|
|
||||||
// Fetch the list of files in the current directory
|
// Fetch the list of files in the current directory
|
||||||
Common::FSList fslist;
|
Common::FSList fslist;
|
||||||
Common::FilesystemNode dir(ConfMan.get("path"));
|
Common::FSNode dir(ConfMan.get("path"));
|
||||||
if (!dir.getChildren(fslist, Common::FilesystemNode::kListFilesOnly)) {
|
if (!dir.getChildren(fslist, Common::FSNode::kListFilesOnly)) {
|
||||||
return kInvalidPathError;
|
return kInvalidPathError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get file size */
|
/* get file size */
|
||||||
Common::FilesystemNode node(_fileName);
|
Common::FSNode node(_fileName);
|
||||||
fi.file = node.openForReading();
|
fi.file = node.openForReading();
|
||||||
if (!fi.file) {
|
if (!fi.file) {
|
||||||
error("Cannot open file %s", _fileName.c_str());
|
error("Cannot open file %s", _fileName.c_str());
|
||||||
|
|
|
@ -1010,7 +1010,7 @@ void ScummEngine_v60he::o60_openFile() {
|
||||||
// TODO / FIXME: Consider using listSavefiles to avoid unneccessary openForLoading calls
|
// TODO / FIXME: Consider using listSavefiles to avoid unneccessary openForLoading calls
|
||||||
_hInFileTable[slot] = _saveFileMan->openForLoading(filename);
|
_hInFileTable[slot] = _saveFileMan->openForLoading(filename);
|
||||||
if (_hInFileTable[slot] == 0) {
|
if (_hInFileTable[slot] == 0) {
|
||||||
Common::FilesystemNode node(filename);
|
Common::FSNode node(filename);
|
||||||
_hInFileTable[slot] = node.openForReading();
|
_hInFileTable[slot] = node.openForReading();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -143,7 +143,7 @@ void Sword1CheckDirectory(const Common::FSList &fslist, bool *filesFound) {
|
||||||
for (int cnt = 0; cnt < ARRAYSIZE(g_dirNames); cnt++)
|
for (int cnt = 0; cnt < ARRAYSIZE(g_dirNames); cnt++)
|
||||||
if (scumm_stricmp(file->getName().c_str(), g_dirNames[cnt]) == 0) {
|
if (scumm_stricmp(file->getName().c_str(), g_dirNames[cnt]) == 0) {
|
||||||
Common::FSList fslist2;
|
Common::FSList fslist2;
|
||||||
if (file->getChildren(fslist2, Common::FilesystemNode::kListFilesOnly))
|
if (file->getChildren(fslist2, Common::FSNode::kListFilesOnly))
|
||||||
Sword1CheckDirectory(fslist2, filesFound);
|
Sword1CheckDirectory(fslist2, filesFound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ GameList Sword2MetaEngine::detectGames(const Common::FSList &fslist) const {
|
||||||
|
|
||||||
if (0 == scumm_stricmp("clusters", fileName)) {
|
if (0 == scumm_stricmp("clusters", fileName)) {
|
||||||
Common::FSList recList;
|
Common::FSList recList;
|
||||||
if (file->getChildren(recList, Common::FilesystemNode::kListAll)) {
|
if (file->getChildren(recList, Common::FSNode::kListAll)) {
|
||||||
GameList recGames(detectGames(recList));
|
GameList recGames(detectGames(recList));
|
||||||
if (!recGames.empty()) {
|
if (!recGames.empty()) {
|
||||||
detectedGames.push_back(recGames);
|
detectedGames.push_back(recGames);
|
||||||
|
@ -212,8 +212,8 @@ PluginError Sword2MetaEngine::createInstance(OSystem *syst, Engine **engine) con
|
||||||
assert(engine);
|
assert(engine);
|
||||||
|
|
||||||
Common::FSList fslist;
|
Common::FSList fslist;
|
||||||
Common::FilesystemNode dir(ConfMan.get("path"));
|
Common::FSNode dir(ConfMan.get("path"));
|
||||||
if (!dir.getChildren(fslist, Common::FilesystemNode::kListAll)) {
|
if (!dir.getChildren(fslist, Common::FSNode::kListAll)) {
|
||||||
return kInvalidPathError;
|
return kInvalidPathError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ int BrowserDialog::runModal() {
|
||||||
err = FSRefMakePath(&ref, (UInt8*)buf, sizeof(buf)-1);
|
err = FSRefMakePath(&ref, (UInt8*)buf, sizeof(buf)-1);
|
||||||
assert(err == noErr);
|
assert(err == noErr);
|
||||||
|
|
||||||
_choice = Common::FilesystemNode(buf);
|
_choice = Common::FSNode(buf);
|
||||||
choiceMade = true;
|
choiceMade = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,9 +160,9 @@ BrowserDialog::BrowserDialog(const char *title, bool dirBrowser)
|
||||||
|
|
||||||
void BrowserDialog::open() {
|
void BrowserDialog::open() {
|
||||||
if (ConfMan.hasKey("browser_lastpath"))
|
if (ConfMan.hasKey("browser_lastpath"))
|
||||||
_node = Common::FilesystemNode(ConfMan.get("browser_lastpath"));
|
_node = Common::FSNode(ConfMan.get("browser_lastpath"));
|
||||||
if (!_node.isDirectory())
|
if (!_node.isDirectory())
|
||||||
_node = Common::FilesystemNode(".");
|
_node = Common::FSNode(".");
|
||||||
|
|
||||||
// Alway refresh file list
|
// Alway refresh file list
|
||||||
updateListing();
|
updateListing();
|
||||||
|
@ -227,9 +227,9 @@ void BrowserDialog::updateListing() {
|
||||||
ConfMan.set("browser_lastpath", _node.getPath());
|
ConfMan.set("browser_lastpath", _node.getPath());
|
||||||
|
|
||||||
// Read in the data from the file system
|
// Read in the data from the file system
|
||||||
Common::FilesystemNode::ListMode listMode =
|
Common::FSNode::ListMode listMode =
|
||||||
_isDirBrowser ? Common::FilesystemNode::kListDirectoriesOnly
|
_isDirBrowser ? Common::FSNode::kListDirectoriesOnly
|
||||||
: Common::FilesystemNode::kListAll;
|
: Common::FSNode::kListAll;
|
||||||
if (!_node.getChildren(_nodeContent, listMode)) {
|
if (!_node.getChildren(_nodeContent, listMode)) {
|
||||||
_nodeContent.clear();
|
_nodeContent.clear();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const Common::FilesystemNode &getResult() { return _choice; }
|
const Common::FSNode &getResult() { return _choice; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
|
@ -58,10 +58,10 @@ protected:
|
||||||
#else
|
#else
|
||||||
ListWidget *_fileList;
|
ListWidget *_fileList;
|
||||||
StaticTextWidget *_currentPath;
|
StaticTextWidget *_currentPath;
|
||||||
Common::FilesystemNode _node;
|
Common::FSNode _node;
|
||||||
Common::FSList _nodeContent;
|
Common::FSList _nodeContent;
|
||||||
#endif
|
#endif
|
||||||
Common::FilesystemNode _choice;
|
Common::FSNode _choice;
|
||||||
bool _isDirBrowser;
|
bool _isDirBrowser;
|
||||||
|
|
||||||
#ifndef MACOSX
|
#ifndef MACOSX
|
||||||
|
|
|
@ -395,7 +395,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
||||||
|
|
||||||
if (browser.runModal() > 0) {
|
if (browser.runModal() > 0) {
|
||||||
// User made this choice...
|
// User made this choice...
|
||||||
Common::FilesystemNode file(browser.getResult());
|
Common::FSNode file(browser.getResult());
|
||||||
_soundFont->setLabel(file.getPath());
|
_soundFont->setLabel(file.getPath());
|
||||||
|
|
||||||
if (!file.getPath().empty() && (file.getPath() != "None"))
|
if (!file.getPath().empty() && (file.getPath() != "None"))
|
||||||
|
@ -413,11 +413,11 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
||||||
BrowserDialog browser("Select directory with game data", true);
|
BrowserDialog browser("Select directory with game data", true);
|
||||||
if (browser.runModal() > 0) {
|
if (browser.runModal() > 0) {
|
||||||
// User made his choice...
|
// User made his choice...
|
||||||
Common::FilesystemNode dir(browser.getResult());
|
Common::FSNode dir(browser.getResult());
|
||||||
|
|
||||||
// TODO: Verify the game can be found in the new directory... Best
|
// TODO: Verify the game can be found in the new directory... Best
|
||||||
// done with optional specific gameid to pluginmgr detectgames?
|
// done with optional specific gameid to pluginmgr detectgames?
|
||||||
// FSList files = dir.listDir(FilesystemNode::kListFilesOnly);
|
// FSList files = dir.listDir(FSNode::kListFilesOnly);
|
||||||
|
|
||||||
_gamePathWidget->setLabel(dir.getPath());
|
_gamePathWidget->setLabel(dir.getPath());
|
||||||
draw();
|
draw();
|
||||||
|
@ -431,7 +431,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
||||||
BrowserDialog browser("Select additional game directory", true);
|
BrowserDialog browser("Select additional game directory", true);
|
||||||
if (browser.runModal() > 0) {
|
if (browser.runModal() > 0) {
|
||||||
// User made his choice...
|
// User made his choice...
|
||||||
Common::FilesystemNode dir(browser.getResult());
|
Common::FSNode dir(browser.getResult());
|
||||||
_extraPathWidget->setLabel(dir.getPath());
|
_extraPathWidget->setLabel(dir.getPath());
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
||||||
BrowserDialog browser("Select directory for saved games", true);
|
BrowserDialog browser("Select directory for saved games", true);
|
||||||
if (browser.runModal() > 0) {
|
if (browser.runModal() > 0) {
|
||||||
// User made his choice...
|
// User made his choice...
|
||||||
Common::FilesystemNode dir(browser.getResult());
|
Common::FSNode dir(browser.getResult());
|
||||||
_savePathWidget->setLabel(dir.getPath());
|
_savePathWidget->setLabel(dir.getPath());
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
@ -953,9 +953,9 @@ void LauncherDialog::addGame() {
|
||||||
|
|
||||||
if (_browser->runModal() > 0) {
|
if (_browser->runModal() > 0) {
|
||||||
// User made his choice...
|
// User made his choice...
|
||||||
Common::FilesystemNode dir(_browser->getResult());
|
Common::FSNode dir(_browser->getResult());
|
||||||
Common::FSList files;
|
Common::FSList files;
|
||||||
if (!dir.getChildren(files, Common::FilesystemNode::kListAll)) {
|
if (!dir.getChildren(files, Common::FSNode::kListAll)) {
|
||||||
error("browser returned a node that is not a directory: '%s'",
|
error("browser returned a node that is not a directory: '%s'",
|
||||||
dir.getPath().c_str());
|
dir.getPath().c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ enum {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MassAddDialog::MassAddDialog(const Common::FilesystemNode &startDir)
|
MassAddDialog::MassAddDialog(const Common::FSNode &startDir)
|
||||||
: Dialog("massadddialog"),
|
: Dialog("massadddialog"),
|
||||||
_dirsScanned(0),
|
_dirsScanned(0),
|
||||||
_okButton(0),
|
_okButton(0),
|
||||||
|
@ -156,10 +156,10 @@ void MassAddDialog::handleTickle() {
|
||||||
|
|
||||||
// Perform a breadth-first scan of the filesystem.
|
// Perform a breadth-first scan of the filesystem.
|
||||||
while (!_scanStack.empty() && (g_system->getMillis() - t) < kMaxScanTime) {
|
while (!_scanStack.empty() && (g_system->getMillis() - t) < kMaxScanTime) {
|
||||||
Common::FilesystemNode dir = _scanStack.pop();
|
Common::FSNode dir = _scanStack.pop();
|
||||||
|
|
||||||
Common::FSList files;
|
Common::FSList files;
|
||||||
if (!dir.getChildren(files, Common::FilesystemNode::kListAll)) {
|
if (!dir.getChildren(files, Common::FSNode::kListAll)) {
|
||||||
error("browser returned a node that is not a directory: '%s'",
|
error("browser returned a node that is not a directory: '%s'",
|
||||||
dir.getPath().c_str());
|
dir.getPath().c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,14 +38,14 @@ class StaticTextWidget;
|
||||||
|
|
||||||
class MassAddDialog : public Dialog {
|
class MassAddDialog : public Dialog {
|
||||||
public:
|
public:
|
||||||
MassAddDialog(const Common::FilesystemNode &startDir);
|
MassAddDialog(const Common::FSNode &startDir);
|
||||||
|
|
||||||
//void open();
|
//void open();
|
||||||
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
||||||
void handleTickle();
|
void handleTickle();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Common::Stack<Common::FilesystemNode> _scanStack;
|
Common::Stack<Common::FSNode> _scanStack;
|
||||||
GameList _games;
|
GameList _games;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -835,7 +835,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
||||||
BrowserDialog browser("Select directory for savegames", true);
|
BrowserDialog browser("Select directory for savegames", true);
|
||||||
if (browser.runModal() > 0) {
|
if (browser.runModal() > 0) {
|
||||||
// User made his choice...
|
// User made his choice...
|
||||||
Common::FilesystemNode dir(browser.getResult());
|
Common::FSNode dir(browser.getResult());
|
||||||
if (dir.isWritable()) {
|
if (dir.isWritable()) {
|
||||||
_savePath->setLabel(dir.getPath());
|
_savePath->setLabel(dir.getPath());
|
||||||
} else {
|
} else {
|
||||||
|
@ -851,7 +851,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
||||||
BrowserDialog browser("Select directory for GUI themes", true);
|
BrowserDialog browser("Select directory for GUI themes", true);
|
||||||
if (browser.runModal() > 0) {
|
if (browser.runModal() > 0) {
|
||||||
// User made his choice...
|
// User made his choice...
|
||||||
Common::FilesystemNode dir(browser.getResult());
|
Common::FSNode dir(browser.getResult());
|
||||||
_themePath->setLabel(dir.getPath());
|
_themePath->setLabel(dir.getPath());
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
@ -861,7 +861,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
||||||
BrowserDialog browser("Select directory for extra files", true);
|
BrowserDialog browser("Select directory for extra files", true);
|
||||||
if (browser.runModal() > 0) {
|
if (browser.runModal() > 0) {
|
||||||
// User made his choice...
|
// User made his choice...
|
||||||
Common::FilesystemNode dir(browser.getResult());
|
Common::FSNode dir(browser.getResult());
|
||||||
_extraPath->setLabel(dir.getPath());
|
_extraPath->setLabel(dir.getPath());
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
@ -872,7 +872,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
||||||
BrowserDialog browser("Select directory for plugins", true);
|
BrowserDialog browser("Select directory for plugins", true);
|
||||||
if (browser.runModal() > 0) {
|
if (browser.runModal() > 0) {
|
||||||
// User made his choice...
|
// User made his choice...
|
||||||
Common::FilesystemNode dir(browser.getResult());
|
Common::FSNode dir(browser.getResult());
|
||||||
_pluginsPath->setLabel(dir.getPath());
|
_pluginsPath->setLabel(dir.getPath());
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
@ -883,7 +883,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
|
||||||
BrowserDialog browser("Select SoundFont", false);
|
BrowserDialog browser("Select SoundFont", false);
|
||||||
if (browser.runModal() > 0) {
|
if (browser.runModal() > 0) {
|
||||||
// User made his choice...
|
// User made his choice...
|
||||||
Common::FilesystemNode file(browser.getResult());
|
Common::FSNode file(browser.getResult());
|
||||||
_soundFont->setLabel(file.getPath());
|
_soundFont->setLabel(file.getPath());
|
||||||
|
|
||||||
if (!file.getPath().empty() && (file.getPath() != "None"))
|
if (!file.getPath().empty() && (file.getPath() != "None"))
|
||||||
|
|
|
@ -101,10 +101,10 @@ void ThemeBrowser::updateListing() {
|
||||||
// files in other places are ignored in this dialog
|
// files in other places are ignored in this dialog
|
||||||
// TODO: let the user browse the complete FS too/only the FS?
|
// TODO: let the user browse the complete FS too/only the FS?
|
||||||
if (ConfMan.hasKey("themepath"))
|
if (ConfMan.hasKey("themepath"))
|
||||||
addDir(_themes, Common::FilesystemNode(ConfMan.get("themepath")), 0);
|
addDir(_themes, Common::FSNode(ConfMan.get("themepath")), 0);
|
||||||
|
|
||||||
#ifdef DATA_PATH
|
#ifdef DATA_PATH
|
||||||
addDir(_themes, Common::FilesystemNode(DATA_PATH));
|
addDir(_themes, Common::FSNode(DATA_PATH));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
|
@ -112,7 +112,7 @@ void ThemeBrowser::updateListing() {
|
||||||
if (resourceUrl) {
|
if (resourceUrl) {
|
||||||
char buf[256];
|
char buf[256];
|
||||||
if (CFURLGetFileSystemRepresentation(resourceUrl, true, (UInt8 *)buf, 256)) {
|
if (CFURLGetFileSystemRepresentation(resourceUrl, true, (UInt8 *)buf, 256)) {
|
||||||
Common::FilesystemNode resourcePath(buf);
|
Common::FSNode resourcePath(buf);
|
||||||
addDir(_themes, resourcePath, 0);
|
addDir(_themes, resourcePath, 0);
|
||||||
}
|
}
|
||||||
CFRelease(resourceUrl);
|
CFRelease(resourceUrl);
|
||||||
|
@ -120,9 +120,9 @@ void ThemeBrowser::updateListing() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ConfMan.hasKey("extrapath"))
|
if (ConfMan.hasKey("extrapath"))
|
||||||
addDir(_themes, Common::FilesystemNode(ConfMan.get("extrapath")));
|
addDir(_themes, Common::FSNode(ConfMan.get("extrapath")));
|
||||||
|
|
||||||
addDir(_themes, Common::FilesystemNode("."), 0);
|
addDir(_themes, Common::FSNode("."), 0);
|
||||||
|
|
||||||
// Populate the ListWidget
|
// Populate the ListWidget
|
||||||
Common::StringList list;
|
Common::StringList list;
|
||||||
|
@ -137,7 +137,7 @@ void ThemeBrowser::updateListing() {
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeBrowser::addDir(ThList &list, const Common::FilesystemNode &node, int level) {
|
void ThemeBrowser::addDir(ThList &list, const Common::FSNode &node, int level) {
|
||||||
if (level < 0)
|
if (level < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ void ThemeBrowser::addDir(ThList &list, const Common::FilesystemNode &node, int
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Common::FSList fslist;
|
Common::FSList fslist;
|
||||||
if (!node.getChildren(fslist, Common::FilesystemNode::kListAll))
|
if (!node.getChildren(fslist, Common::FSNode::kListAll))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Common::FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) {
|
for (Common::FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) {
|
||||||
|
@ -169,7 +169,7 @@ void ThemeBrowser::addDir(ThList &list, const Common::FilesystemNode &node, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThemeBrowser::isTheme(const Common::FilesystemNode &node, Entry &out) {
|
bool ThemeBrowser::isTheme(const Common::FSNode &node, Entry &out) {
|
||||||
Common::ConfigFile cfg;
|
Common::ConfigFile cfg;
|
||||||
Common::String type;
|
Common::String type;
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,8 @@ private:
|
||||||
|
|
||||||
void updateListing();
|
void updateListing();
|
||||||
|
|
||||||
void addDir(ThList &list, const Common::FilesystemNode &node, int level = 4);
|
void addDir(ThList &list, const Common::FSNode &node, int level = 4);
|
||||||
bool isTheme(const Common::FilesystemNode &node, Entry &out);
|
bool isTheme(const Common::FSNode &node, Entry &out);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace GUI
|
} // end of namespace GUI
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue