In article , Chris Morse wrote: > On Fri, 29 Aug 2003 20:39:22 GMT, "John B. Matthews" > wrote: > > >Rob, Chris & Co: > > > >I'm starting a new thread in case others are working with > >AppleCommander. I found a few problems with Pascal dates in > >v1.2.3. > (SNIP) > >John > >---- > >jmatthews at wright dot edu > >www dot wright dot edu/~john.matthews/ > > Just working on my "GET" routine for ProDOS, and it seems that there's > a bug in the FormattedDisk.getFile(List files, String filename) > function. > > I have it searching for a file that appears AFTER an entry that is a > directory. The routine never searches for any root-level files after > the first root-level directory is found. > > Here's the original function from FormattedDisk.java: > > protected FileEntry getFile(List files, String filename) { > FileEntry theFileEntry = null; > if (files != null) { > for (int i=0; i FileEntry entry = (FileEntry) files.get(i); > if (entry.isDirectory()) { > theFileEntry = getFile( > ((DirectoryEntry)entry).getFiles(), filename); > break; > } > String otherFilename = entry.getFilename(); > if (otherFilename != null) otherFilename = otherFilename.trim(); > if (filename.equalsIgnoreCase(otherFilename)) { > theFileEntry = entry; > break; > } > } > } > return theFileEntry; > } > > That first "break;" in the "if(entry.isDirectory())" statement should > be something like "if(theFileEntry != null) break;" so that it will > keep searching if it didn't find the file. Once I changed that, it > worked and found the file I was going after. > > // CHRIS I noticed this, too; your solution is quite economical. I did something a bit different at the application level in order to get the full traversal and also skip deleted entries: static FileEntry getEntry(List files, String fileName) { FileEntry theEntry = null; if (files != null) { for (int i=0; i