HierarchicalFileList.st
changeset 2734 4934113dc4c0
parent 2654 d6925414a41d
child 2766 04990ee7e604
equal deleted inserted replaced
2733:7b5a0d80c4a8 2734:4934113dc4c0
   943 ! !
   943 ! !
   944 
   944 
   945 !HierarchicalFileList::Directory methodsFor:'fetching'!
   945 !HierarchicalFileList::Directory methodsFor:'fetching'!
   946 
   946 
   947 basicFetchIndicator
   947 basicFetchIndicator
   948     |linkName fileName hasChildren|
   948     |linkName fileName hasChildren info|
   949 
   949 
   950     fileName := self fileName.
   950     fileName := self fileName.
   951     linkName := fileName name.
   951     info := fileName linkInfo.
   952     fileName isSymbolicLink ifTrue:[
   952     (info notNil and:[info isSymbolicLink]) ifTrue:[
   953         linkName := fileName linkInfo path.
   953         linkName := info path.
   954     ].
   954     ] ifFalse:[
       
   955         linkName := fileName name.
       
   956     ].
       
   957         
   955     (OperatingSystem mountPoints contains:[:mp | mp mountPointPath = linkName]) ifTrue:[
   958     (OperatingSystem mountPoints contains:[:mp | mp mountPointPath = linkName]) ifTrue:[
   956         "do not follow mounted directories automatically (could be an NFS hardlink)"
   959         "do not follow mounted directories automatically (could be an NFS hardlink)"
   957         ^ self.
   960         ^ self.
   958     ].
   961     ].
   959 
   962 
   960     hasChildren := DirectoryContents directoryNamed:fileName detect:(self model matchBlock).
   963     hasChildren := DirectoryContents directoryNamed:fileName detect:(self model matchBlock).
   961     self knownToHaveChildren:hasChildren.
   964     self knownToHaveChildren:hasChildren.
   962     children notNil ifTrue:[self halt:'oops'].
   965     self assert:children isNil.
   963 
   966 
   964     children isNil ifTrue:[
   967     (children isNil and:[info notNil]) ifTrue:[
   965         "setup modification time to suppress monitorCycle
   968         "setup modification time to suppress monitorCycle"
   966         "
   969         modificationTime := info modificationTime.
   967         modificationTime := fileName modificationTime.
       
   968     ].
   970     ].
   969 !
   971 !
   970 
   972 
   971 fetchIndicator
   973 fetchIndicator
   972     "fetch the indicator value which indicates whether children exist or not.
   974     "fetch the indicator value which indicates whether children exist or not.
  1140     ].
  1142     ].
  1141 !
  1143 !
  1142 
  1144 
  1143 monitoringCycle
  1145 monitoringCycle
  1144     "run monitoring cycle
  1146     "run monitoring cycle
  1145         !!!!!!!! called by the HierarchicalList only !!!!!!!!
  1147         !!!!!!!! called by the HierarchicalList only !!!!!!!!"
  1146     "
  1148 
  1147     |fileName unusedDict addedItems mergedList size modifyTime model timeChanged|
  1149     |fileName unusedDict addedItems mergedList size modifyTime model timeChanged info|
  1148 
  1150 
  1149     fileName := self fileName.
  1151     fileName := self fileName.
  1150     fileName isSymbolicLink ifTrue:[
  1152     info := fileName linkInfo.
  1151         modifyTime := fileName linkInfo modificationTime.
  1153     info isNil ifTrue:[^ self].
  1152     ] ifFalse:[
  1154 
  1153         modifyTime := fileName modificationTime.
  1155     modifyTime := info modificationTime.
  1154     ].
  1156     timeChanged := modifyTime ~= modificationTime.
  1155     modifyTime isNil ifTrue:[^ self].
       
  1156 
       
  1157     timeChanged := (modificationTime isNil or:[modifyTime ~= modificationTime]).
       
  1158     modificationTime := modifyTime.
  1157     modificationTime := modifyTime.
  1159 
  1158 
  1160     children notNil ifTrue:[
  1159     children notNil ifTrue:[
  1161         timeChanged ifFalse:[
  1160         timeChanged ifFalse:[
  1162             ^ self
  1161             ^ self
  1254 ! !
  1253 ! !
  1255 
  1254 
  1256 !HierarchicalFileList class methodsFor:'documentation'!
  1255 !HierarchicalFileList class methodsFor:'documentation'!
  1257 
  1256 
  1258 version
  1257 version
  1259     ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalFileList.st,v 1.51 2004-02-25 07:24:49 ca Exp $'
  1258     ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalFileList.st,v 1.52 2004-08-13 19:30:55 stefan Exp $'
  1260 ! !
  1259 ! !
  1261 
  1260 
  1262 HierarchicalFileList::Directory initialize!
  1261 HierarchicalFileList::Directory initialize!