[Scummvm-cvs-logs] SF.net SVN: scummvm: [23553] scummvm/trunk/common
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sat Jul 22 16:14:54 CEST 2006
Revision: 23553
Author: fingolfin
Date: 2006-07-22 07:14:16 -0700 (Sat, 22 Jul 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=23553&view=rev
Log Message:
-----------
Added FilesystemNode::name method
Modified Paths:
--------------
scummvm/trunk/backends/fs/abstract-fs.h
scummvm/trunk/backends/fs/amigaos4/amigaos4-fs.cpp
scummvm/trunk/backends/fs/dc/dc-fs.cpp
scummvm/trunk/backends/fs/ds/ds-fs.cpp
scummvm/trunk/backends/fs/ds/ds-fs.h
scummvm/trunk/backends/fs/gp32/gp32-fs.cpp
scummvm/trunk/backends/fs/morphos/abox-fs.cpp
scummvm/trunk/backends/fs/palmos/palmos-fs.cpp
scummvm/trunk/backends/fs/posix/posix-fs.cpp
scummvm/trunk/backends/fs/ps2/ps2-fs.cpp
scummvm/trunk/backends/fs/psp/psp_fs.cpp
scummvm/trunk/backends/fs/symbian/symbian-fs.cpp
scummvm/trunk/backends/fs/windows/windows-fs.cpp
scummvm/trunk/common/fs.cpp
scummvm/trunk/common/fs.h
Modified: scummvm/trunk/backends/fs/abstract-fs.h
===================================================================
--- scummvm/trunk/backends/fs/abstract-fs.h 2006-07-22 10:56:11 UTC (rev 23552)
+++ scummvm/trunk/backends/fs/abstract-fs.h 2006-07-22 14:14:16 UTC (rev 23553)
@@ -99,7 +99,11 @@
public:
virtual ~AbstractFilesystemNode() {}
- virtual String displayName() const = 0;
+ virtual String name() const = 0;
+
+ // By default, we use the actual file name as 'display name'.
+ virtual String displayName() const { return name(); }
+
virtual bool isDirectory() const = 0;
/**
Modified: scummvm/trunk/backends/fs/amigaos4/amigaos4-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/amigaos4/amigaos4-fs.cpp 2006-07-22 10:56:11 UTC (rev 23552)
+++ scummvm/trunk/backends/fs/amigaos4/amigaos4-fs.cpp 2006-07-22 14:14:16 UTC (rev 23553)
@@ -64,6 +64,7 @@
virtual ~AmigaOSFilesystemNode();
virtual String displayName() const { return _sDisplayName; };
+ virtual String name() const { return _sDisplayName; };
virtual bool isValid() const { return _bIsValid; };
virtual bool isDirectory() const { return _bIsDirectory; };
virtual String path() const { return _sPath; };
@@ -71,7 +72,7 @@
virtual bool listDir(AbstractFSList &list, ListMode mode) const;
virtual AbstractFSList listVolumes() const;
virtual AbstractFilesystemNode *parent() const;
- virtual AbstractFilesystemNode *child(const String &name) const;
+ virtual AbstractFilesystemNode *child(const String &n) const;
};
AbstractFilesystemNode *AbstractFilesystemNode::getCurrentDirectory() {
@@ -159,11 +160,11 @@
_pFileLock = 0;
while (1) {
- char *name = new char[bufSize];
- if (IDOS->NameFromLock(pLock, (STRPTR)name, bufSize) != DOSFALSE) {
- _sPath = name;
- _sDisplayName = pDisplayName ? pDisplayName : IDOS->FilePart((STRPTR)name);
- delete [] name;
+ char *n = new char[bufSize];
+ if (IDOS->NameFromLock(pLock, (STRPTR)n, bufSize) != DOSFALSE) {
+ _sPath = n;
+ _sDisplayName = pDisplayName ? pDisplayName : IDOS->FilePart((STRPTR)n);
+ delete [] n;
break;
}
@@ -171,11 +172,11 @@
_bIsValid = false;
debug(6, "IoErr() != ERROR_LINE_TOO_LONG");
LEAVE();
- delete [] name;
+ delete [] n;
return;
}
bufSize *= 2;
- delete [] name;
+ delete [] n;
}
_bIsValid = false;
@@ -327,12 +328,12 @@
return node;
}
-AbstractFilesystemNode *AmigaOSFilesystemNode::child(const String &name) const {
+AbstractFilesystemNode *AmigaOSFilesystemNode::child(const String &n) const {
assert(_bIsDirectory);
String newPath(_sPath);
if (_sPath.lastChar() != '/')
newPath += '/';
- newPath += name;
+ newPath += n;
return new AmigaOSFilesystemNode(newPath);
}
@@ -342,7 +343,7 @@
AbstractFSList myList;
const uint32 kLockFlags = LDF_READ | LDF_VOLUMES;
- char name[MAXPATHLEN];
+ char n[MAXPATHLEN];
struct DosList *dosList = IDOS->LockDosList(kLockFlags);
if (!dosList) {
@@ -360,13 +361,13 @@
const char *volName = (const char *)BADDR(dosList->dol_Name)+1;
const char *devName = (const char *)((struct Task *)dosList->dol_Task->mp_SigTask)->tc_Node.ln_Name;
- strcpy(name, volName);
- strcat(name, ":");
+ strcpy(n, volName);
+ strcat(n, ":");
- BPTR volumeLock = IDOS->Lock((STRPTR)name, SHARED_LOCK);
+ BPTR volumeLock = IDOS->Lock((STRPTR)n, SHARED_LOCK);
if (volumeLock) {
- sprintf(name, "%s (%s)", volName, devName);
- AmigaOSFilesystemNode *entry = new AmigaOSFilesystemNode(volumeLock, name);
+ sprintf(n, "%s (%s)", volName, devName);
+ AmigaOSFilesystemNode *entry = new AmigaOSFilesystemNode(volumeLock, n);
if (entry) {
if (entry->isValid())
myList.push_back(entry);
Modified: scummvm/trunk/backends/fs/dc/dc-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/dc/dc-fs.cpp 2006-07-22 10:56:11 UTC (rev 23552)
+++ scummvm/trunk/backends/fs/dc/dc-fs.cpp 2006-07-22 14:14:16 UTC (rev 23553)
@@ -51,7 +51,7 @@
virtual bool listDir(AbstractFSList &list, ListMode mode) const;
virtual AbstractFilesystemNode *parent() const;
- virtual AbstractFilesystemNode *child(const String &name) const;
+ virtual AbstractFilesystemNode *child(const String &n) const;
};
@@ -163,14 +163,14 @@
return p;
}
-AbstractFilesystemNode *RoninCDFilesystemNode::child(const String &name) const {
+AbstractFilesystemNode *RoninCDFilesystemNode::child(const String &n) const {
// FIXME: Pretty lame implementation! We do no error checking to speak
// of, do not check if this is a special node, etc.
assert(_isDirectory);
String newPath(_path);
if (_path.lastChar() != '/')
newPath += '/';
- newPath += name;
+ newPath += n;
RoninCDFilesystemNode *p = new RoninCDFilesystemNode(newPath, true);
return p;
Modified: scummvm/trunk/backends/fs/ds/ds-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/ds/ds-fs.cpp 2006-07-22 10:56:11 UTC (rev 23552)
+++ scummvm/trunk/backends/fs/ds/ds-fs.cpp 2006-07-22 14:14:16 UTC (rev 23553)
@@ -151,11 +151,11 @@
}
-AbstractFilesystemNode *DSFileSystemNode::child(const Common::String& name) const {
+AbstractFilesystemNode *DSFileSystemNode::child(const Common::String& n) const {
if (_path.lastChar() == '\\') {
- return new DSFileSystemNode(_path + name);
+ return new DSFileSystemNode(_path + n);
} else {
- return new DSFileSystemNode(_path + "\\" + name);
+ return new DSFileSystemNode(_path + "\\" + n);
}
return NULL;
@@ -193,14 +193,14 @@
if (_zipFile->restartFile()) {
do {
- char name[128];
- _zipFile->getFileName(name);
+ char n[128];
+ _zipFile->getFileName(n);
-// consolePrintf("file: %s\n", name);
+// consolePrintf("file: %s\n", n);
if ( (_zipFile->isDirectory() && ((mode == FilesystemNode::kListDirectoriesOnly) || (mode == FilesystemNode::kListAll)) )
|| (!_zipFile->isDirectory() && ((mode == FilesystemNode::kListFilesOnly) || (mode == FilesystemNode::kListAll)) ) )
{
- DSFileSystemNode* dsfsn = new DSFileSystemNode("ds:/" + String(name), _zipFile->isDirectory());
+ DSFileSystemNode* dsfsn = new DSFileSystemNode("ds:/" + String(n), _zipFile->isDirectory());
dsfsn->_isDirectory = _zipFile->isDirectory();
dirList.push_back((dsfsn));
}
@@ -311,11 +311,11 @@
}
-AbstractFilesystemNode *GBAMPFileSystemNode::child(const Common::String& name) const {
+AbstractFilesystemNode *GBAMPFileSystemNode::child(const Common::String& n) const {
if (_path.lastChar() == '\\') {
- return new DSFileSystemNode(_path + name);
+ return new DSFileSystemNode(_path + n);
} else {
- return new DSFileSystemNode(_path + "\\" + name);
+ return new DSFileSystemNode(_path + "\\" + n);
}
return NULL;
Modified: scummvm/trunk/backends/fs/ds/ds-fs.h
===================================================================
--- scummvm/trunk/backends/fs/ds/ds-fs.h 2006-07-22 10:56:11 UTC (rev 23552)
+++ scummvm/trunk/backends/fs/ds/ds-fs.h 2006-07-22 14:14:16 UTC (rev 23553)
@@ -59,6 +59,7 @@
DSFileSystemNode(const String& path, bool isDir);
virtual String displayName() const { return _displayName; }
+ virtual String name() const { return _displayName; }
virtual bool isValid() const { return _isValid; }
virtual bool isDirectory() const { return _isDirectory; }
virtual String path() const { return _path; }
Modified: scummvm/trunk/backends/fs/gp32/gp32-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/gp32/gp32-fs.cpp 2006-07-22 10:56:11 UTC (rev 23552)
+++ scummvm/trunk/backends/fs/gp32/gp32-fs.cpp 2006-07-22 14:14:16 UTC (rev 23553)
@@ -39,13 +39,14 @@
GP32FilesystemNode(const String &path);
virtual String displayName() const { return _displayName; }
+ virtual String name() const { return _displayName; }
virtual bool isValid() const { return true; }
virtual bool isDirectory() const { return _isDirectory; }
virtual String path() const { return _path; }
virtual bool listDir(AbstractFSList &list, ListMode mode) const;
virtual AbstractFilesystemNode *parent() const;
- virtual AbstractFilesystemNode *child(const String &name) const;
+ virtual AbstractFilesystemNode *child(const String &n) const;
};
#define MAX_PATH_SIZE 256
@@ -216,14 +217,14 @@
return p;
}
-AbstractFilesystemNode *GP32FilesystemNode::child(const String &name) const {
+AbstractFilesystemNode *GP32FilesystemNode::child(const String &n) const {
// FIXME: Pretty lame implementation! We do no error checking to speak
// of, do not check if this is a special node, etc.
assert(_isDirectory);
String newPath(_path);
if (_path.lastChar() != '\\')
newPath += '\\';
- newPath += name;
+ newPath += n;
GP32FilesystemNode *p = new GP32FilesystemNode(newPath);
return p;
Modified: scummvm/trunk/backends/fs/morphos/abox-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/morphos/abox-fs.cpp 2006-07-22 10:56:11 UTC (rev 23552)
+++ scummvm/trunk/backends/fs/morphos/abox-fs.cpp 2006-07-22 14:14:16 UTC (rev 23553)
@@ -46,6 +46,7 @@
~ABoxFilesystemNode();
virtual String displayName() const { return _displayName; }
+ virtual String name() const { return _displayName; }
virtual bool isValid() const { return _isValid; }
virtual bool isDirectory() const { return _isDirectory; }
virtual String path() const { return _path; }
@@ -53,7 +54,7 @@
virtual bool listDir(AbstractFSList &list, ListMode mode) const;
static AbstractFSList listRoot();
virtual AbstractFilesystemNode *parent() const;
- virtual AbstractFilesystemNode *child(const String &name) const;
+ virtual AbstractFilesystemNode *child(const String &n) const;
};
@@ -82,11 +83,11 @@
_lock = NULL;
for (;;)
{
- char name[bufsize];
- if (NameFromLock(lock, name, bufsize) != DOSFALSE)
+ char n[bufsize];
+ if (NameFromLock(lock, n, bufsize) != DOSFALSE)
{
- _path = name;
- _displayName = display_name ? display_name : FilePart(name);
+ _path = n;
+ _displayName = display_name ? display_name : FilePart(n);
break;
}
if (IoErr() != ERROR_LINE_TOO_LONG)
@@ -216,7 +217,7 @@
return node;
}
-AbstractFilesystemNode *ABoxFilesystemNode::child(const String &name) const {
+AbstractFilesystemNode *ABoxFilesystemNode::child(const String &n) const {
TODO
}
@@ -225,7 +226,7 @@
AbstractFSList myList;
DosList *dosList;
CONST ULONG lockDosListFlags = LDF_READ | LDF_VOLUMES;
- char name[256];
+ char n[256];
dosList = LockDosList(lockDosListFlags);
if (dosList == NULL)
@@ -247,13 +248,13 @@
CONST_STRPTR device_name = (CONST_STRPTR)((struct Task *)dosList->dol_Task->mp_SigTask)->tc_Node.ln_Name;
BPTR volume_lock;
- strcpy(name, volume_name);
- strcat(name, ":");
- volume_lock = Lock(name, SHARED_LOCK);
+ strcpy(n, volume_name);
+ strcat(n, ":");
+ volume_lock = Lock(n, SHARED_LOCK);
if (volume_lock)
{
- sprintf(name, "%s (%s)", volume_name, device_name);
- entry = new ABoxFilesystemNode(volume_lock, name);
+ sprintf(n, "%s (%s)", volume_name, device_name);
+ entry = new ABoxFilesystemNode(volume_lock, n);
if (entry)
{
if (entry->isValid())
Modified: scummvm/trunk/backends/fs/palmos/palmos-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/palmos/palmos-fs.cpp 2006-07-22 10:56:11 UTC (rev 23552)
+++ scummvm/trunk/backends/fs/palmos/palmos-fs.cpp 2006-07-22 14:14:16 UTC (rev 23553)
@@ -44,13 +44,14 @@
PalmOSFilesystemNode(const String &p);
virtual String displayName() const { return _displayName; }
+ virtual String name() const { return _displayName; }
virtual bool isValid() const { return _isValid; }
virtual bool isDirectory() const { return _isDirectory; }
virtual String path() const { return _path; }
virtual bool listDir(AbstractFSList &list, ListMode mode) const;
virtual AbstractFilesystemNode *parent() const;
- virtual AbstractFilesystemNode *child(const String &name) const;
+ virtual AbstractFilesystemNode *child(const String &n) const;
private:
static void addFile (AbstractFSList &list, ListMode mode, const Char *base, FileInfoType* find_data);
@@ -179,13 +180,13 @@
}
-AbstractFilesystemNode *PalmOSFilesystemNode::child(const String &name) const {
+AbstractFilesystemNode *PalmOSFilesystemNode::child(const String &n) const {
assert(_isDirectory);
String newPath(_path);
if (_path.lastChar() != '/')
newPath += '/';
- newPath += name;
+ newPath += n;
FileRef handle;
UInt32 attr;
Modified: scummvm/trunk/backends/fs/posix/posix-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/posix/posix-fs.cpp 2006-07-22 10:56:11 UTC (rev 23552)
+++ scummvm/trunk/backends/fs/posix/posix-fs.cpp 2006-07-22 14:14:16 UTC (rev 23553)
@@ -50,13 +50,14 @@
POSIXFilesystemNode(const String &path, bool verify);
virtual String displayName() const { return _displayName; }
+ virtual String name() const { return _displayName; }
virtual bool isValid() const { return _isValid; }
virtual bool isDirectory() const { return _isDirectory; }
virtual String path() const { return _path; }
virtual bool listDir(AbstractFSList &list, ListMode mode) const;
virtual AbstractFilesystemNode *parent() const;
- virtual AbstractFilesystemNode *child(const String &name) const;
+ virtual AbstractFilesystemNode *child(const String &n) const;
};
@@ -208,14 +209,14 @@
return p;
}
-AbstractFilesystemNode *POSIXFilesystemNode::child(const String &name) const {
+AbstractFilesystemNode *POSIXFilesystemNode::child(const String &n) const {
// FIXME: Pretty lame implementation! We do no error checking to speak
// of, do not check if this is a special node, etc.
assert(_isDirectory);
String newPath(_path);
if (_path.lastChar() != '/')
newPath += '/';
- newPath += name;
+ newPath += n;
POSIXFilesystemNode *p = new POSIXFilesystemNode(newPath, true);
return p;
Modified: scummvm/trunk/backends/fs/ps2/ps2-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/ps2/ps2-fs.cpp 2006-07-22 10:56:11 UTC (rev 23552)
+++ scummvm/trunk/backends/fs/ps2/ps2-fs.cpp 2006-07-22 14:14:16 UTC (rev 23553)
@@ -42,6 +42,7 @@
Ps2FilesystemNode(const String &path);
virtual String displayName() const { return _displayName; }
+ virtual String name() const { return _displayName; }
virtual bool isValid() const { return !_isRoot; }
virtual bool isDirectory() const { return _isDirectory; }
virtual String path() const { return _path; }
@@ -50,7 +51,7 @@
virtual bool listDir(AbstractFSList &list, ListMode mode) const;
virtual AbstractFilesystemNode *parent() const;
virtual AbstractFilesystemNode *clone() const { return new Ps2FilesystemNode(this); }
- virtual AbstractFilesystemNode *child(const String &name) const;
+ virtual AbstractFilesystemNode *child(const String &n) const;
};
AbstractFilesystemNode *AbstractFilesystemNode::getCurrentDirectory() {
@@ -188,7 +189,7 @@
return new Ps2FilesystemNode();
}
-AbstractFilesystemNode *Ps2FilesystemNode::child(const String &name) const {
+AbstractFilesystemNode *Ps2FilesystemNode::child(const String &n) const {
if (!_isDirectory)
return NULL;
@@ -200,7 +201,7 @@
iox_dirent_t dirent;
while (fio.dread(fd, &dirent) > 0) {
- if (strcmp(name.c_str(), dirent.name) == 0) {
+ if (strcmp(n.c_str(), dirent.name) == 0) {
Ps2FilesystemNode *dirEntry = new Ps2FilesystemNode();
dirEntry->_isDirectory = (bool)(dirent.stat.mode & FIO_S_IFDIR);
Modified: scummvm/trunk/backends/fs/psp/psp_fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/psp/psp_fs.cpp 2006-07-22 10:56:11 UTC (rev 23552)
+++ scummvm/trunk/backends/fs/psp/psp_fs.cpp 2006-07-22 14:14:16 UTC (rev 23553)
@@ -49,13 +49,14 @@
PSPFilesystemNode(const Common::String &p, bool verify);
virtual String displayName() const { return _displayName; }
+ virtual String name() const { return _displayName; }
virtual bool isValid() const { return _isValid; }
virtual bool isDirectory() const { return _isDirectory; }
virtual String path() const { return _path; }
virtual bool listDir(AbstractFSList &list, ListMode mode) const;
virtual AbstractFilesystemNode *parent() const;
- virtual AbstractFilesystemNode *child(const String &name) const;
+ virtual AbstractFilesystemNode *child(const String &n) const;
};
AbstractFilesystemNode *AbstractFilesystemNode::getCurrentDirectory() {
@@ -157,14 +158,14 @@
return p;
}
-AbstractFilesystemNode *PSPFilesystemNode::child(const String &name) const {
+AbstractFilesystemNode *PSPFilesystemNode::child(const String &n) const {
// FIXME: Pretty lame implementation! We do no error checking to speak
// of, do not check if this is a special node, etc.
assert(_isDirectory);
String newPath(_path);
if (_path.lastChar() != '/')
newPath += '/';
- newPath += name;
+ newPath += n;
PSPFilesystemNode *p = new PSPFilesystemNode(newPath, true);
return p;
Modified: scummvm/trunk/backends/fs/symbian/symbian-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/symbian/symbian-fs.cpp 2006-07-22 10:56:11 UTC (rev 23552)
+++ scummvm/trunk/backends/fs/symbian/symbian-fs.cpp 2006-07-22 14:14:16 UTC (rev 23553)
@@ -47,13 +47,14 @@
SymbianFilesystemNode(bool aIsRoot);
SymbianFilesystemNode(const String &path);
virtual String displayName() const { return _displayName; }
+ virtual String name() const { return _displayName; }
virtual bool isValid() const { return _isValid; }
virtual bool isDirectory() const { return _isDirectory; }
virtual String path() const { return _path; }
virtual bool listDir(AbstractFSList &list, ListMode mode) const;
virtual AbstractFilesystemNode *parent() const;
- virtual AbstractFilesystemNode *child(const String &name) const;
+ virtual AbstractFilesystemNode *child(const String &n) const;
};
@@ -206,13 +207,13 @@
return p;
}
-AbstractFilesystemNode *SymbianFilesystemNode::child(const String &name) const {
+AbstractFilesystemNode *SymbianFilesystemNode::child(const String &n) const {
assert(_isDirectory);
String newPath(_path);
if (_path.lastChar() != '\\')
newPath += '\\';
- newPath += name;
+ newPath += n;
TPtrC8 ptr((const unsigned char*) newPath.c_str(), newPath.size());
TFileName fname;
Modified: scummvm/trunk/backends/fs/windows/windows-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/windows/windows-fs.cpp 2006-07-22 10:56:11 UTC (rev 23552)
+++ scummvm/trunk/backends/fs/windows/windows-fs.cpp 2006-07-22 14:14:16 UTC (rev 23553)
@@ -45,13 +45,14 @@
WindowsFilesystemNode(const String &path);
virtual String displayName() const { return _displayName; }
+ virtual String name() const { return _displayName; }
virtual bool isValid() const { return _isValid; }
virtual bool isDirectory() const { return _isDirectory; }
virtual String path() const { return _path; }
virtual bool listDir(AbstractFSList &list, ListMode mode) const;
virtual AbstractFilesystemNode *parent() const;
- virtual AbstractFilesystemNode *child(const String &name) const;
+ virtual AbstractFilesystemNode *child(const String &n) const;
private:
static char *toAscii(TCHAR *x);
@@ -240,12 +241,12 @@
return p;
}
-AbstractFilesystemNode *WindowsFilesystemNode::child(const String &name) const {
+AbstractFilesystemNode *WindowsFilesystemNode::child(const String &n) const {
assert(_isDirectory);
String newPath(_path);
if (_path.lastChar() != '\\')
newPath += '\\';
- newPath += name;
+ newPath += n;
// Check whether the directory actually exists
DWORD fileAttribs = GetFileAttributes(toUnicode(newPath.c_str()));
Modified: scummvm/trunk/common/fs.cpp
===================================================================
--- scummvm/trunk/common/fs.cpp 2006-07-22 10:56:11 UTC (rev 23552)
+++ scummvm/trunk/common/fs.cpp 2006-07-22 14:14:16 UTC (rev 23553)
@@ -89,12 +89,12 @@
}
}
-FilesystemNode FilesystemNode::getChild(const String &name) const {
+FilesystemNode FilesystemNode::getChild(const String &n) const {
if (_realNode == 0)
return *this;
assert(_realNode->isDirectory());
- AbstractFilesystemNode *node = _realNode->child(name);
+ AbstractFilesystemNode *node = _realNode->child(n);
return FilesystemNode(node);
}
@@ -115,15 +115,20 @@
return true;
}
+bool FilesystemNode::isDirectory() const {
+ if (_realNode == 0)
+ return false;
+ return _realNode->isDirectory();
+}
+
Common::String FilesystemNode::displayName() const {
assert(_realNode);
return _realNode->displayName();
}
-bool FilesystemNode::isDirectory() const {
- if (_realNode == 0)
- return false;
- return _realNode->isDirectory();
+Common::String FilesystemNode::name() const {
+ assert(_realNode);
+ return _realNode->name();
}
Common::String FilesystemNode::path() const {
Modified: scummvm/trunk/common/fs.h
===================================================================
--- scummvm/trunk/common/fs.h 2006-07-22 10:56:11 UTC (rev 23552)
+++ scummvm/trunk/common/fs.h 2006-07-22 14:14:16 UTC (rev 23553)
@@ -135,6 +135,16 @@
virtual bool listDir(FSList &fslist, ListMode mode = kListDirectoriesOnly) const;
/**
+ * Is this node pointing to a directory?
+ * @todo Currently we assume that a valid node that is not a directory
+ * automatically is a file (ignoring things like symlinks). That might
+ * actually be OK... but we could still add an isFile method. Or even replace
+ * isValid and isDirectory by a getType() method that can return values like
+ * kDirNodeType, kFileNodeType, kInvalidNodeType.
+ */
+ virtual bool isDirectory() const;
+
+ /**
* Return a human readable string for this node, usable for display (e.g.
* in the GUI code). Do *not* rely on it being usable for anything else,
* like constructing paths!
@@ -143,20 +153,25 @@
virtual String displayName() const;
/**
- * Is this node pointing to a directory?
- * @todo Currently we assume that a valid node that is not a directory
- * automatically is a file (ignoring things like symlinks). That might
- * actually be OK... but we could still add an isFile method. Or even replace
- * isValid and isDirectory by a getType() method that can return values like
- * kDirNodeType, kFileNodeType, kInvalidNodeType.
+ * Return a string representation of the name of the file. This is can be
+ * used e.g. by detection code that relies on matching the name of a given
+ * file. But it is *not* suitable for use with fopen / File::open, nor
+ * should it be archived.
+ *
+ * @return the file name
*/
- virtual bool isDirectory() const;
+ virtual String name() const;
/**
* Return a string representation of the file which can be passed to fopen(),
* and is suitable for archiving (i.e. writing to the config file).
* This will usually be a 'path' (hence the name of the method), but can
- * be anything that fulfilly the above criterions.
+ * be anything that fulfills the above criterions.
+ *
+ * @note Do not assume that this string contains (back)slashes or any
+ * other kind of 'path separators'.
+ *
+ * @return the 'path' represented by this filesystem node
*/
virtual String path() const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list