diff options
| author | David Corrales | 2007-10-31 17:43:40 +0000 | 
|---|---|---|
| committer | David Corrales | 2007-10-31 17:43:40 +0000 | 
| commit | b5653141fa3c0aa7692d3e299f89a17b93f4e1ee (patch) | |
| tree | 9da1f456e4e08c9246ea2368430aca359ba09c85 /backends/fs | |
| parent | 2ac075e5692f45b2ca3a3ceac98e3bba290a45a0 (diff) | |
| download | scummvm-rg350-b5653141fa3c0aa7692d3e299f89a17b93f4e1ee.tar.gz scummvm-rg350-b5653141fa3c0aa7692d3e299f89a17b93f4e1ee.tar.bz2 scummvm-rg350-b5653141fa3c0aa7692d3e299f89a17b93f4e1ee.zip  | |
Properly implemented the isReadable() and isWritable() methods for the AmigaOSFilesystemNode backend.
Thanks a lot to Raziel_One on this one :)
svn-id: r29339
Diffstat (limited to 'backends/fs')
| -rw-r--r-- | backends/fs/amigaos4/amigaos4-fs.cpp | 66 | 
1 files changed, 64 insertions, 2 deletions
diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index 20b3cfc4c8..e195ee5629 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -92,8 +92,8 @@ public:  	virtual String getName() const { return _sDisplayName; };  	virtual String getPath() const { return _sPath; };  	virtual bool isDirectory() const { return _bIsDirectory; }; -	virtual bool isReadable() const { return true; }	//FIXME: this is just a stub -	virtual bool isWritable() const { return true; }	//FIXME: this is just a stub +	virtual bool isReadable() const; +	virtual bool isWritable() const;  	virtual AbstractFilesystemNode *getChild(const String &n) const;  	virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; @@ -428,6 +428,68 @@ AbstractFilesystemNode *AmigaOSFilesystemNode::getParent() const {  	return node;  } +bool AmigaOSFilesystemNode::isReadable() const { +	ENTER(); +	 +	bool readable = false;	 +	struct FileInfoBlock *fib = (struct FileInfoBlock *)IDOS->AllocDosObject(DOS_FIB, NULL); +	if (!fib) { +		debug(6, "FileInfoBlock is NULL"); +		LEAVE(); +		return false; +	} +	 +	BPTR pLock = IDOS->Lock((STRPTR)_sPath.c_str(), SHARED_LOCK); +	if (pLock) { +		if (IDOS->Examine(pLock, fib) != DOSFALSE) { +			/* The fib_Protection flag is low-active or inverted, thus the negation. +			 *  +			 * For more information, consult the compiler/include/dos/dos.h +			 * file from the AROS source (http://aros.sourceforge.net/). +			 */ +			if (!(fib->fib_Protection & FIBF_READ)) { +				readable = true; +			} +		} +		IDOS->UnLock(pLock); +	} +	 +	IDOS->FreeDosObject(DOS_FIB, fib); +	LEAVE(); +	return readable; +} + +bool AmigaOSFilesystemNode::isWritable() const { +	ENTER(); +	 +	bool writable = false;	 +	struct FileInfoBlock *fib = (struct FileInfoBlock *)IDOS->AllocDosObject(DOS_FIB, NULL); +	if (!fib) { +		debug(6, "FileInfoBlock is NULL"); +		LEAVE(); +		return false; +	} +	 +	BPTR pLock = IDOS->Lock((STRPTR)_sPath.c_str(), SHARED_LOCK); +	if (pLock) { +		if (IDOS->Examine(pLock, fib) != DOSFALSE) { +			/* The fib_Protection flag is low-active or inverted, thus the negation. +			 *  +			 * For more information, consult the compiler/include/dos/dos.h +			 * file from the AROS source (http://aros.sourceforge.net/). +			 */ +			if (!(fib->fib_Protection & FIBF_WRITE)) { +				writable = true; +			} +		} +		IDOS->UnLock(pLock); +	} +	 +	IDOS->FreeDosObject(DOS_FIB, fib); +	LEAVE(); +	return writable; +} +  AbstractFSList AmigaOSFilesystemNode::listVolumes()	const {  	ENTER();  | 
