Skip to content

Commit

Permalink
Merge pull request #424 from wjp/amigaos4-fs
Browse files Browse the repository at this point in the history
AMIGAOS4: FSNode fixes
  • Loading branch information
wjp committed Jan 23, 2014
2 parents 3fd28f3 + 219a68e commit 22acfe8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 7 additions & 6 deletions backends/fs/amigaos4/amigaos4-fs.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -305,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();
Expand All @@ -332,6 +327,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
Expand All @@ -341,6 +339,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)
Expand Down
6 changes: 6 additions & 0 deletions backends/fs/amigaos4/amigaos4-fs.h
Expand Up @@ -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;
Expand Down

0 comments on commit 22acfe8

Please sign in to comment.