diff options
| author | Max Horn | 2006-05-01 21:53:31 +0000 | 
|---|---|---|
| committer | Max Horn | 2006-05-01 21:53:31 +0000 | 
| commit | e4a7de9d754c7e9b9a9f4f313b3a89bf4b5283af (patch) | |
| tree | e1ba171360f53556f713af5f6cfd53467787371d /backends/fs | |
| parent | 77c29d0ab20de8fbdd7954602f3759d110eea2dd (diff) | |
| download | scummvm-rg350-e4a7de9d754c7e9b9a9f4f313b3a89bf4b5283af.tar.gz scummvm-rg350-e4a7de9d754c7e9b9a9f4f313b3a89bf4b5283af.tar.bz2 scummvm-rg350-e4a7de9d754c7e9b9a9f4f313b3a89bf4b5283af.zip | |
Patch #1479919 (AmigaOS maintaining)
svn-id: r22267
Diffstat (limited to 'backends/fs')
| -rw-r--r-- | backends/fs/amigaos4/amigaos4-fs.cpp | 51 | 
1 files changed, 28 insertions, 23 deletions
| diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index d98b64f381..92897ff0ca 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -114,11 +114,8 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(const String &p) {  	}  	_sDisplayName = String(str + offset, len); -  	_pFileLock = 0; -	// Check whether it is a directory, and whether the file actually exists -  	struct FileInfoBlock *fib = (struct FileInfoBlock *)IDOS->AllocDosObject(DOS_FIB, NULL);  	if (!fib) {  		debug(6, "FileInfoBlock is NULL"); @@ -126,22 +123,25 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(const String &p) {  		return;  	} +	// Check whether the node exists and if it is a directory  	BPTR pLock = IDOS->Lock((STRPTR)_sPath.c_str(), SHARED_LOCK);  	if (pLock) {  		if (IDOS->Examine(pLock, fib) != DOSFALSE) { -			if (fib->fib_EntryType > 0) +			if (FIB_IS_DRAWER(fib)) {  				_bIsDirectory = true; -			else -				_bIsDirectory = false; - -			if (_bIsDirectory) { -				if (fib->fib_EntryType != ST_ROOT) -					_sPath += "/"; -  				_pFileLock = IDOS->DupLock(pLock);  				_bIsValid = (_pFileLock != 0); + +				// Add a trailing slash if it is needed +				const char c = _sPath.lastChar(); +				if (c != '/' && c != ':') +					_sPath += '/'; +  			} -			else _bIsValid = true; +			else { +				_bIsDirectory = false; +				_bIsValid = true; +			}			   		}  	} @@ -184,19 +184,19 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(BPTR pLock, const char *pDisplayNam  	}  	if (IDOS->Examine(pLock, fib) != DOSFALSE) { -		if (fib->fib_EntryType > 0) +		if (FIB_IS_DRAWER(fib)) {  			_bIsDirectory = true; -		else -			_bIsDirectory = false; - -		if (_bIsDirectory) { -			if (fib->fib_EntryType != ST_ROOT) -				_sPath += "/"; -  			_pFileLock = IDOS->DupLock(pLock); -			_bIsValid = (_pFileLock != 0); +			_bIsValid = _pFileLock != 0; + +			const char c = _sPath.lastChar(); +			if (c != '/' && c != ':') +				_sPath += '/';  		} -		else _bIsValid = true; +		else { +			_bIsDirectory = false; +			_bIsValid = true; +		}		   	}  	IDOS->FreeDosObject(DOS_FIB, fib); @@ -325,7 +325,12 @@ AbstractFilesystemNode *AmigaOSFilesystemNode::parent() const {  }  AbstractFilesystemNode *AmigaOSFilesystemNode::child(const String &name) const { -	TODO +	assert(_bIsDirectory); +	String newPath(_sPath); +	if (_sPath.lastChar() != '/') +		newPath += '/'; +	newPath += name; +	return new AmigaOSFilesystemNode(newPath);  }  FSList AmigaOSFilesystemNode::listVolumes(void)	const { | 
