DirectoryStream.st
changeset 17290 47f6863bcbce
parent 17287 04ef8ce2c146
child 17291 3177810ab9ae
equal deleted inserted replaced
17289:9df64c66192f 17290:47f6863bcbce
   520 nextLinkInfo
   520 nextLinkInfo
   521     "return the next FileStatusInfo or nil"
   521     "return the next FileStatusInfo or nil"
   522 
   522 
   523     |nextResult resultInfo|
   523     |nextResult resultInfo|
   524 
   524 
   525     hitEOF ifFalse:[
   525     hitEOF ifTrue:[
   526 	nextResult := OperatingSystem nextLinkInfoFrom:self dirPointer:dirPointer.
   526         ^ self pastEndRead
   527 	nextResult isNil ifTrue:[
   527     ].
   528 	    hitEOF := true.
   528 
   529 	].
   529     nextResult := OperatingSystem nextLinkInfoFrom:self dirPointer:dirPointer.
   530     ].
   530     nextResult isNil ifTrue:[
   531     resultInfo := readAheadEntry.
   531         hitEOF := true.
   532     resultInfo isNil ifTrue:[^ self pastEndRead].
   532     ].
   533     readAheadEntry := nextResult.
   533     readAheadEntry notNil ifTrue:[
   534     ^ resultInfo
   534         resultInfo := readAheadEntry.
       
   535         readAheadEntry := nextResult.
       
   536         ^ resultInfo
       
   537     ].
       
   538     nextResult isNil ifTrue:[
       
   539         ^ self pastEndRead
       
   540     ].
       
   541     ^ nextResult
   535 ! !
   542 ! !
   536 
   543 
   537 !DirectoryStream protectedMethodsFor:'instance release'!
   544 !DirectoryStream protectedMethodsFor:'instance release'!
   538 
   545 
   539 closeFile
   546 closeFile
   564 
   571 
   565     |ok encodedPathName error fileSize osPathname osModTime osCrtTime osAccTime osFileAttributes |
   572     |ok encodedPathName error fileSize osPathname osModTime osCrtTime osAccTime osFileAttributes |
   566 
   573 
   567     encodedPathName := OperatingSystem encodePath:pathName.
   574     encodedPathName := OperatingSystem encodePath:pathName.
   568     mode := #readonly.
   575     mode := #readonly.
       
   576     hitEOF := false.
   569 
   577 
   570 %{
   578 %{
   571 #ifdef HAS_OPENDIR
   579 #ifdef HAS_OPENDIR
   572     DIR *d;
   580     DIR *d;
   573     OBJ path, dp;
   581     OBJ path, dp;
   714 !DirectoryStream methodsFor:'testing'!
   722 !DirectoryStream methodsFor:'testing'!
   715 
   723 
   716 atEnd
   724 atEnd
   717     "return true, if position is at end"
   725     "return true, if position is at end"
   718 
   726 
   719     ^ readAheadEntry == nil
   727     ^ hitEOF "/ readAheadEntry == nil
   720 !
   728 !
   721 
   729 
   722 isEmpty
   730 isEmpty
   723     "test for if the unread portion of the directory stream is empty.
   731     "test for if the unread portion of the directory stream is empty.
   724      This query changes the readPointer of the DirectoryStream"
   732      This query changes the readPointer of the DirectoryStream"
   747 ! !
   755 ! !
   748 
   756 
   749 !DirectoryStream class methodsFor:'documentation'!
   757 !DirectoryStream class methodsFor:'documentation'!
   750 
   758 
   751 version
   759 version
   752     ^ '$Header: /cvs/stx/stx/libbasic/DirectoryStream.st,v 1.83 2015-01-12 13:55:30 ca Exp $'
   760     ^ '$Header: /cvs/stx/stx/libbasic/DirectoryStream.st,v 1.84 2015-01-12 15:36:51 cg Exp $'
   753 !
   761 !
   754 
   762 
   755 version_CVS
   763 version_CVS
   756     ^ '$Header: /cvs/stx/stx/libbasic/DirectoryStream.st,v 1.83 2015-01-12 13:55:30 ca Exp $'
   764     ^ '$Header: /cvs/stx/stx/libbasic/DirectoryStream.st,v 1.84 2015-01-12 15:36:51 cg Exp $'
   757 ! !
   765 ! !
   758 
   766