From 58aaef33c11e4f140c962f96e54a326baa724c0e Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 22 Jan 2014 22:51:44 +0100 Subject: AMIGAOS4: Make isReadable return false for non-existent files This also properly initializes _bIsValid for non-existent files. For consistency, isWritable() is changed analogously to isReadable(), even though it should not lead to changes in behaviour. --- backends/fs/amigaos4/amigaos4-fs.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index 6d713f10be..d0578307f4 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -81,6 +81,7 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(const Common::String &p) { _sDisplayName = ::lastPathComponent(_sPath); _pFileLock = 0; _bIsDirectory = false; + _bIsValid = false; // Check whether the node exists and if it is a directory struct ExamineData * pExd = IDOS->ExamineObjectTags(EX_StringNameInput,_sPath.c_str(),TAG_END); @@ -332,6 +333,9 @@ AbstractFSNode *AmigaOSFilesystemNode::getParent() const { } bool AmigaOSFilesystemNode::isReadable() const { + if (!_bIsValid) + return false; + // Regular RWED protection flags are low-active or inverted, thus the negation. // moreover pseudo root filesystem (null _pFileLock) is readable whatever the // protection says @@ -341,6 +345,9 @@ bool AmigaOSFilesystemNode::isReadable() const { } bool AmigaOSFilesystemNode::isWritable() const { + if (!_bIsValid) + return false; + // Regular RWED protection flags are low-active or inverted, thus the negation. // moreover pseudo root filesystem (null _pFileLock) is never writable whatever // the protection says (because of the pseudo nature) -- cgit v1.2.3 From d32816c0279ebf064542dafd1f1b257f0661bd2a Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 22 Jan 2014 22:53:14 +0100 Subject: AMIGAOS4: Allow getParent() to work for non-directories --- backends/fs/amigaos4/amigaos4-fs.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index d0578307f4..bd8bf1978a 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -306,12 +306,6 @@ bool AmigaOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b AbstractFSNode *AmigaOSFilesystemNode::getParent() const { ENTER(); - if (!_bIsDirectory) { - debug(6, "Not a directory"); - LEAVE(); - return 0; - } - if (_pFileLock == 0) { debug(6, "Root node"); LEAVE(); -- cgit v1.2.3 From 219a68eeda2c0e14a29f1cfb969dabe3a70e1544 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 22 Jan 2014 22:00:49 +0100 Subject: AMIGAOS4: Clarify virtual fs root node --- backends/fs/amigaos4/amigaos4-fs.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backends/fs/amigaos4/amigaos4-fs.h b/backends/fs/amigaos4/amigaos4-fs.h index c5ca61476f..7ce9981479 100644 --- a/backends/fs/amigaos4/amigaos4-fs.h +++ b/backends/fs/amigaos4/amigaos4-fs.h @@ -43,7 +43,13 @@ */ class AmigaOSFilesystemNode : public AbstractFSNode { protected: + /** + * The main file lock. + * If this is NULL but _bIsValid is true, then this Node references + * the virtual filesystem root. + */ BPTR _pFileLock; + Common::String _sDisplayName; Common::String _sPath; bool _bIsDirectory; -- cgit v1.2.3