care for case-insensitive systems in pattern-match (windows)
authorClaus Gittinger <cg@exept.de>
Mon, 20 Dec 1999 11:55:29 +0100
changeset 2093 ac231f0404d9
parent 2092 15fb126b15af
child 2094 31eff84c4d0f
care for case-insensitive systems in pattern-match (windows)
FileSelectionList.st
--- a/FileSelectionList.st	Fri Dec 17 21:48:20 1999 +0100
+++ b/FileSelectionList.st	Mon Dec 20 11:55:29 1999 +0100
@@ -877,7 +877,7 @@
     "set the lists contents to the filenames in the directory"
 
     |oldCursor files newList index obsolete 
-     matching patternList dir|
+     matching patternList dir ignoreCase|
 
     directory isNil ifTrue:[
         super list:nil.
@@ -916,6 +916,8 @@
     newList := OrderedCollection new.
     index := 1.
 
+    ignoreCase := Filename isCaseSensitive not.
+
     dir := directory pathName asFilename.
     files do:[:name |
         |type fullName|
@@ -940,16 +942,9 @@
                 ignoreFiles ifFalse:[
                     matching := true.
 
-                    (pattern isNil 
-                    or:[pattern isEmpty]) ifFalse:[
-                        pattern = '*' ifFalse:[
-                            (pattern includes:$;) ifTrue:[
-                                patternList := pattern asCollectionOfSubstringsSeparatedBy:$;.
-                                patternList := patternList collect:[:p | p withoutSeparators].
-                                matching := (patternList findFirst:[:subPattern | subPattern match:name]) ~~ 0.
-                            ] ifFalse:[
-                                matching := pattern match:name
-                            ]
+                    (pattern size > 0) ifTrue:[ 
+                        pattern ~= '*' ifTrue:[
+                            matching := pattern compoundMatch:name ignoreCase:ignoreCase
                         ]
                     ].
                                     
@@ -966,7 +961,7 @@
     self cursor:oldCursor.
 
     "Modified: / 18.9.1997 / 23:43:52 / stefan"
-    "Modified: / 22.9.1998 / 14:44:02 / cg"
+    "Modified: / 16.12.1999 / 01:23:41 / cg"
 !
 
 visibleLineNeedsSpecialCare:visLineNr
@@ -1012,5 +1007,5 @@
 !FileSelectionList class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionList.st,v 1.45 1999-06-18 19:42:30 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionList.st,v 1.46 1999-12-20 10:55:29 cg Exp $'
 ! !