code cleanup
authorClaus Gittinger <cg@exept.de>
Wed, 02 Apr 2003 18:54:57 +0200
changeset 4765 da557dd8bf69
parent 4764 1b33d0592a11
child 4766 723fc2feb38c
code cleanup
AbstractFileBrowser.st
--- a/AbstractFileBrowser.st	Wed Apr 02 18:31:18 2003 +0200
+++ b/AbstractFileBrowser.st	Wed Apr 02 18:54:57 2003 +0200
@@ -2638,7 +2638,7 @@
             | filenames newFilenames|
             filenames := holder value.
             newFilenames := Set new.
-            filenames do:[ : filename |  | fn |
+            filenames do:[:filename |  | fn |
                 fn := filename.                              
                 [fn exists not] whileTrue:[
                     fn := fn directory.
@@ -4302,8 +4302,9 @@
                             with:ex description) withCRs.
             ^ self
         ].
-        fileNames := fileNames collect:[:fn | dir construct:fn].
-        fileNames := fileNames select:[:fn | fn isDirectory not].
+        fileNames := fileNames 
+                        collect:[:fn | dir construct:fn]
+                        thenSelect:[:fn | fn isDirectory not].
 
 "/        self label:myName , '- gathering sizes ...'.
         infoDir := Dictionary new.
@@ -4423,8 +4424,9 @@
         directories do:[ : dir|
             [
                 fileNames := dir directoryContents.
-                fileNames := fileNames collect:[:fn | dir construct:fn].
-                fileNames := fileNames select:[:fn | fn isDirectory not].
+                fileNames := fileNames 
+                                collect:[:fn | dir construct:fn]
+                                thenSelect:[:fn | fn isDirectory not].
                 allFiles addAll:fileNames.
             ] on:FileStream openErrorSignal do:[:ex|
                 self warn:('Cannot access: %1\(%2)' 
@@ -5328,19 +5330,24 @@
     "get stat info on selected file - return a string which can be
      shown in a box"
 
-    | selFiles filename text fileOutput type modeBits modeString s ts isLink info 
-      sizeString fileSize|
+    | selFiles filename fileOutput type modeBits modeString s isLink info 
+      sizeString fileSize tAccess tModification buffer|
 
     selFiles := self currentFileNameHolder value.
     ((selFiles size == 1) not) ifTrue:[ ^ nil].
     filename := selFiles first.
 
-    text := StringCollection new.
-
-    text add:('filename: ', filename asString).
+    buffer := '' asText writeStream.
+
+    buffer 
+        nextPutAll:'filename: '; 
+        nextPutLine:filename asString.
+
     isLink := filename isSymbolicLink.
     isLink ifTrue:[
-        text add:('symbolic link to: ', (filename linkInfo path))
+        buffer 
+            nextPutAll:'symbolic link to: ';
+            nextPutLine:(filename linkInfo path).
     ].
 
     info := filename info.
@@ -5355,7 +5362,7 @@
     ] ifFalse:[
         s := s , 'regular (' , fileOutput , ')'
     ].
-    text add:s.
+    buffer nextPutLine:s.
     isLink = true ifTrue:[
         info := filename linkInfo
     ] ifFalse:[
@@ -5373,28 +5380,40 @@
         ].
         sizeString := sizeString , ')'. 
     ].
-    text add:sizeString.
+    buffer nextPutLine:sizeString.
 
     modeBits := info mode.
     modeString := self getModeString:modeBits.
+
+    buffer nextPutAll:'access: '; nextPutAll:modeString.
     longInfo ifTrue:[
-        text add:('access: ', modeString,' ', (modeBits printStringRadix:8)).
-    ] ifFalse:[
-        text add:('access: ', modeString)
+        buffer space; nextPutAll:(modeBits printStringRadix:8).
     ].
-    text add:('owner:  ',
-               (OperatingSystem getUserNameFromID:(info uid))).
+    buffer
+        cr;
+        nextPutAll:'owner:  ';
+        nextPutLine:(OperatingSystem getUserNameFromID:(info uid)).
+
     longInfo ifTrue:[
-        text add:('group:  ',
-                   (OperatingSystem getGroupNameFromID:(info gid))).
-
-        ts := info accessTime.
-        text add:('last access:       ',ts asTime printString ,' ', ts asDate printString). 
-
-        ts := info modificationTime.
-        text add:('last modification: ', ts asTime printString, ' ', ts asDate printString).
+        buffer 
+            nextPutAll:'group:  ';
+            nextPutLine:(OperatingSystem getGroupNameFromID:(info gid)).
+
+        tAccess := info accessTime.
+        buffer 
+            nextPutAll:'last access:       '; 
+            nextPutAll:tAccess asTime printString;
+            space;
+            nextPutLine:tAccess asDate printString. 
+
+        tModification := info modificationTime.
+        buffer 
+            nextPutAll:'last modification:       '; 
+            nextPutAll:tModification asTime printString;
+            space;
+            nextPutLine:tModification asDate printString. 
     ].
-    ^ text asString
+    ^ buffer contents
 !
 
 initialCommandFor:fileName into:aBox
@@ -6110,5 +6129,5 @@
 !AbstractFileBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.123 2003-04-01 14:58:28 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.124 2003-04-02 16:54:57 cg Exp $'
 ! !