From 5b9e6a47fc9b7e4e75db3675092363cbb5a1f6d5 Mon Sep 17 00:00:00 2001 From: David Corrales Date: Tue, 30 Oct 2007 21:31:39 +0000 Subject: Implement the AmigaOSFilesystemNode::exists() method. svn-id: r29327 --- backends/fs/amigaos4/amigaos4-fs.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index 71ddd182e2..9d94fdc60c 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -87,7 +87,7 @@ public: */ virtual ~AmigaOSFilesystemNode(); - virtual bool exists() const { return true; } //FIXME: this is just a stub + virtual bool exists() const; virtual String getDisplayName() const { return _sDisplayName; }; virtual String getName() const { return _sDisplayName; }; virtual String getPath() const { return _sPath; }; @@ -265,6 +265,25 @@ AmigaOSFilesystemNode::~AmigaOSFilesystemNode() { LEAVE(); } +bool AmigaOSFilesystemNode::exists() const { + if(_sPath.empty()) + return false; + + bool nodeExists = false; + ENTER(); + + BPTR pLock = IDOS->Lock((STRPTR)_sPath.c_str(), SHARED_LOCK); + if (pLock) { + if (IDOS->Examine(pLock, fib) != DOSFALSE) { + nodeExists = true; + } + IDOS->UnLock(pLock); + } + + LEAVE(); + return nodeExists; +} + AbstractFilesystemNode *AmigaOSFilesystemNode::getChild(const String &n) const { if (!_bIsDirectory) { debug(6, "Not a directory"); -- cgit v1.2.3