544 if the directory-id changed, MUST update. |
544 if the directory-id changed, MUST update. |
545 (can happen after a restart, when a file is no longer |
545 (can happen after a restart, when a file is no longer |
546 there, has moved or is NFS-mounted differently) |
546 there, has moved or is NFS-mounted differently) |
547 " |
547 " |
548 obsolete := directoryId ~~ directory id |
548 obsolete := directoryId ~~ directory id |
549 or:[directoryName ~= directory pathName |
549 or:[directoryName ~= directory pathName |
550 or:[timeStamp notNil |
550 or:[timeStamp notNil |
551 and:[directory timeOfLastChange > timeStamp]]]. |
551 and:[directory timeOfLastChange > timeStamp]]]. |
552 |
552 |
553 obsolete ifTrue:[ |
553 obsolete ifTrue:[ |
554 timeStamp := directory timeOfLastChange. |
554 timeStamp := directory timeOfLastChange. |
555 directoryId := directory id. |
555 directoryId := directory id. |
556 directoryName := directory pathName. |
556 directoryName := directory pathName. |
557 directoryContents := directory asStringCollection sort. |
557 directoryContents := directory asStringCollection sort. |
558 directoryFileTypes := OrderedCollection new. |
558 directoryFileTypes := OrderedCollection new. |
559 directoryContents do:[:name | directoryFileTypes add:(directory typeOf:name)]. |
559 directoryContents do:[:name | directoryFileTypes add:(directory typeOf:name)]. |
560 ]. |
560 ]. |
561 |
561 |
562 files := directoryContents. |
562 files := directoryContents. |
563 newList := OrderedCollection new. |
563 newList := OrderedCollection new. |
564 fileTypes := OrderedCollection new. |
564 fileTypes := OrderedCollection new. |
565 index := 1. |
565 index := 1. |
566 |
566 |
567 path := directory pathName , Filename separator asString. |
567 path := directory pathName , Filename separator asString. |
568 files do:[:name | |
568 files do:[:name | |
569 |type| |
569 |type| |
570 |
570 |
571 (matchBlock isNil or:[matchBlock value:(path , name)]) ifTrue:[ |
571 (matchBlock isNil or:[matchBlock value:(path , name)]) ifTrue:[ |
572 type := directoryFileTypes at:index. |
572 type := directoryFileTypes at:index. |
573 type == #directory ifTrue:[ |
573 type == #directory ifTrue:[ |
574 ignoreDirectories ifFalse:[ |
574 ignoreDirectories ifFalse:[ |
575 name = '..' ifTrue:[ |
575 name = '..' ifTrue:[ |
576 ignoreParentDirectory ifFalse:[ |
576 ignoreParentDirectory ifFalse:[ |
577 newList add:name. |
577 newList add:name. |
578 fileTypes add:type |
578 fileTypes add:type |
579 ] |
579 ] |
580 ] ifFalse:[ |
580 ] ifFalse:[ |
581 name = '.' ifTrue:[ |
581 name = '.' ifTrue:[ |
582 "ignore" |
582 "ignore" |
583 ] ifFalse:[ |
583 ] ifFalse:[ |
584 newList add:(name ", ' ...'"). |
584 newList add:(name ", ' ...'"). |
585 fileTypes add:type |
585 fileTypes add:type |
586 ] |
586 ] |
587 ] |
587 ] |
588 ] |
588 ] |
589 ] ifFalse:[ |
589 ] ifFalse:[ |
590 (pattern isNil |
590 matching := true. |
591 or:[pattern isEmpty |
591 |
592 or:[pattern = '*' |
592 (pattern isNil |
593 or:[pattern match:name]]]) ifTrue:[ |
593 or:[pattern isEmpty]) ifFalse:[ |
594 newList add:name. |
594 pattern = '*' ifFalse:[ |
595 fileTypes add:type |
595 (pattern includes:$;) ifTrue:[ |
596 ] |
596 patternList := pattern asCollectionOfSubstringsSeparatedBy:$;. |
597 ]. |
597 matching := (patternList findFirst:[:subPattern | subPattern match:name]) ~~ 0. |
598 ]. |
598 ] ifFalse:[ |
599 index := index + 1 |
599 matching := pattern match:name |
|
600 ] |
|
601 ] |
|
602 ]. |
|
603 |
|
604 matching ifTrue:[ |
|
605 newList add:name. |
|
606 fileTypes add:type |
|
607 ] |
|
608 ]. |
|
609 ]. |
|
610 index := index + 1 |
600 ]. |
611 ]. |
601 super list:newList. |
612 super list:newList. |
602 |
613 |
603 self cursor:oldCursor. |
614 self cursor:oldCursor. |
604 |
|
605 ! |
615 ! |
606 |
616 |
607 visibleLineNeedsSpecialCare:visLineNr |
617 visibleLineNeedsSpecialCare:visLineNr |
608 |l| |
618 |l| |
609 |
619 |