diff options
author | Max Horn | 2006-05-12 21:41:54 +0000 |
---|---|---|
committer | Max Horn | 2006-05-12 21:41:54 +0000 |
commit | 3623a94927a3d01b6df5c75f42af13a348327c2a (patch) | |
tree | 6c6109147fdbf77457c7b107e3d494fc5a66332c /backends/fs/posix | |
parent | ed339aa771fa7f47a737c0599197dbe205804338 (diff) | |
download | scummvm-rg350-3623a94927a3d01b6df5c75f42af13a348327c2a.tar.gz scummvm-rg350-3623a94927a3d01b6df5c75f42af13a348327c2a.tar.bz2 scummvm-rg350-3623a94927a3d01b6df5c75f42af13a348327c2a.zip |
Added the new AbstractFilesystemNode::getCurrentDirectory() method. Also changed the semantics of the FilesystemNode constructors (see also the relevant doxygen comments for explanations). This also fixes bug #1485941.
svn-id: r22424
Diffstat (limited to 'backends/fs/posix')
-rw-r--r-- | backends/fs/posix/posix-fs.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index ea874c9d0e..c0914bdb43 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -50,7 +50,7 @@ protected: public: POSIXFilesystemNode(); - POSIXFilesystemNode(const String &path, bool verify = false); + POSIXFilesystemNode(const String &path, bool verify); virtual String displayName() const { return _displayName; } virtual bool isValid() const { return _isValid; } @@ -74,6 +74,12 @@ static const char *lastPathComponent(const Common::String &str) { return cur + 1; } +AbstractFilesystemNode *AbstractFilesystemNode::getCurrentDirectory() { + char buf[MAXPATHLEN]; + getcwd(buf, MAXPATHLEN); + return new POSIXFilesystemNode(buf, true); +} + AbstractFilesystemNode *AbstractFilesystemNode::getRoot() { return new POSIXFilesystemNode(); } @@ -156,7 +162,7 @@ bool POSIXFilesystemNode::listDir(AbstractFSList &myList, ListMode mode) const { newPath += '/'; newPath += dp->d_name; - POSIXFilesystemNode entry(newPath); + POSIXFilesystemNode entry(newPath, false); #ifdef __DC__ entry._isDirectory = dp->d_size < 0; @@ -212,7 +218,7 @@ AbstractFilesystemNode *POSIXFilesystemNode::parent() const { const char *start = _path.c_str(); const char *end = lastPathComponent(_path); - POSIXFilesystemNode *p = new POSIXFilesystemNode(String(start, end - start)); + POSIXFilesystemNode *p = new POSIXFilesystemNode(String(start, end - start), false); return p; } |