'From Squeak3.1alpha of 5 February 2001 [latest update: #3752] on 2 March 2001 at 10:17:47 am'! "Change Set: DirEntryFix Date: 2 March 2001 Author: Dan Ingalls Some unix servers seem to be producing an alternate directory entry format. This adapts ServerDirectory>>entries so that it will accept this format. "! !ServerDirectory methodsFor: 'file directory' stamp: 'di 3/2/2001 08:38'! entries "Return a collection of directory entries for the files and directories in this directory. Each entry is a five-element array: ( )." | dir ftpEntries thisYear tokens dateInSeconds longy thisMonth | "We start with ftp directory entries of the form... d--------- 1 owner group 0 Apr 27 22:01 blasttest ---------- 1 owner group 93812 Jul 21 1997 COMMAND.COM 1 2 3 4 5 6 7 8 9 -- token index" self isTypeFile ifTrue: [ urlObject isAbsolute ifFalse: [urlObject default]. ^ (FileDirectory on: urlObject pathForDirectory) entries ]. dir _ self getDirectory. (dir respondsTo: #contentsOfEntireFile) ifFalse: [^ #()]. ftpEntries _ dir contentsOfEntireFile findTokens: FTPSocket crLf. "ftpEntries inspect." thisYear _ Date today year. thisMonth _ Date today monthIndex. ^ ftpEntries collect: [:ftpEntry | tokens _ ftpEntry findTokens: ' '. tokens size = 8 ifTrue: [((tokens at: 6) size ~= 3 and: [(tokens at: 5) size = 3]) ifTrue: ["Fix for case that group is blank (relies on month being 3 chars)" tokens _ tokens copyReplaceFrom: 4 to: 3 with: {'blank'}]]. tokens size >= 9 ifTrue: [((tokens at: 6) size ~= 3 and: [(tokens at: 5) size = 3]) ifTrue: ["Fix for case that group is blank (relies on month being 3 chars)" tokens _ tokens copyReplaceFrom: 4 to: 3 with: {'blank'}]. tokens size > 9 ifTrue: [longy _ tokens at: 9. 10 to: tokens size do: [:i | longy _ longy , ' ' , (tokens at: i)]. tokens at: 9 put: longy]. dateInSeconds _ self secondsForDay: (tokens at: 7) month: (tokens at: 6) yearOrTime: (tokens at: 8) thisMonth: thisMonth thisYear: thisYear. DirectoryEntry name: (tokens at: 9) "file name" creationTime: dateInSeconds "creation date" modificationTime: dateInSeconds "modification time" isDirectory: tokens first first = $d "is-a-directory flag" fileSize: tokens fifth asNumber "file size"] ifFalse: [nil]] thenSelect: [:entry | entry notNil]! ]style[(7 1029 66 168 66 767)f1b,f1,f1cred;,f1,f1cred;,f1! !