Ticket #8530: amigaos4-fs.diff
File amigaos4-fs.diff, 2.3 KB (added by , 19 years ago) |
---|
-
backends/fs/amigaos4/amigaos4-fs.cpp
114 114 } 115 115 116 116 _sDisplayName = String(str + offset, len); 117 118 117 _pFileLock = 0; 119 118 120 // Check whether it is a directory, and whether the file actually exists121 122 119 struct FileInfoBlock *fib = (struct FileInfoBlock *)IDOS->AllocDosObject(DOS_FIB, NULL); 123 120 if (!fib) { 124 121 debug(6, "FileInfoBlock is NULL"); … … 126 123 return; 127 124 } 128 125 126 // Check whether the node exists and if it is a directory 129 127 BPTR pLock = IDOS->Lock((STRPTR)_sPath.c_str(), SHARED_LOCK); 130 128 if (pLock) { 131 129 if (IDOS->Examine(pLock, fib) != DOSFALSE) { 132 if ( fib->fib_EntryType > 0)130 if (FIB_IS_DRAWER(fib)) { 133 131 _bIsDirectory = true; 134 else135 _bIs Directory = false;132 _pFileLock = IDOS->DupLock(pLock); 133 _bIsValid = (_pFileLock != 0); 136 134 137 if (_bIsDirectory) { 138 if (fib->fib_EntryType != ST_ROOT) 139 _sPath += "/"; 135 // Add a trailing slash if it is needed 136 const char c = _sPath.lastChar(); 137 if (c != '/' && c != ':') 138 _sPath += '/'; 140 139 141 _pFileLock = IDOS->DupLock(pLock);142 _bIsValid = (_pFileLock != 0);143 140 } 144 else _bIsValid = true; 141 else { 142 _bIsDirectory = false; 143 _bIsValid = true; 144 } 145 145 } 146 146 } 147 147 … … 184 184 } 185 185 186 186 if (IDOS->Examine(pLock, fib) != DOSFALSE) { 187 if ( fib->fib_EntryType > 0)187 if (FIB_IS_DRAWER(fib)) { 188 188 _bIsDirectory = true; 189 else190 _bIs Directory = false;189 _pFileLock = IDOS->DupLock(pLock); 190 _bIsValid = _pFileLock != 0; 191 191 192 if (_bIsDirectory) { 193 if (fib->fib_EntryType != ST_ROOT) 194 _sPath += "/"; 195 196 _pFileLock = IDOS->DupLock(pLock); 197 _bIsValid = (_pFileLock != 0); 192 const char c = _sPath.lastChar(); 193 if (c != '/' && c != ':') 194 _sPath += '/'; 198 195 } 199 else _bIsValid = true; 196 else { 197 _bIsDirectory = false; 198 _bIsValid = true; 199 } 200 200 } 201 201 202 202 IDOS->FreeDosObject(DOS_FIB, fib); … … 325 325 } 326 326 327 327 AbstractFilesystemNode *AmigaOSFilesystemNode::child(const String &name) const { 328 TODO 328 assert(_bIsDirectory); 329 String newPath(_sPath); 330 if (_sPath.lastChar() != '/') 331 newPath += '/'; 332 newPath += name; 333 return new AmigaOSFilesystemNode(newPath); 329 334 } 330 335 331 336 FSList AmigaOSFilesystemNode::listVolumes(void) const {