care for symbolic links when searching contents.
--- a/FBrowser.st Sat Nov 21 16:16:09 1998 +0100
+++ b/FBrowser.st Sat Nov 21 16:45:29 1998 +0100
@@ -1581,40 +1581,16 @@
files := entry asArray.
1 to:files size-1 do:[:idx1 |
idx1+1 to:files size do:[:idx2 |
- |fn1 fn2 s1 s2 b1 b2 n same|
+ |fn1 fn2|
fn1 := files at:idx1.
fn2 := files at:idx2.
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[
"/ compare the files
-
- (fn1 fileSize < (512*1024)) ifTrue:[
- (fn1 binaryContentsOfEntireFile = fn2 binaryContentsOfEntireFile) ifTrue:[
+ (fn1 sameContentsAs:fn2) ifTrue:[
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName.
- result at:fn1 put:fn2.
- ]
- ] ifFalse:[
- "/ compare blockwise ...
- s1 := fn1 readStream binary.
- s2 := fn2 readStream binary.
- b1 := ByteArray new:8192.
- b2 := ByteArray new:8192.
- same := true.
- [same and:[s1 atEnd not]] whileTrue:[
- n := s1 nextBytes:8192 into:b1 startingAt:1.
- s2 nextBytes:n into:b2 startingAt:1.
- n == 8192 ifFalse:[
- b1 from:n+1 to:8192 put:0.
- b2 from:n+1 to:8192 put:0.
- ].
- same := (b1 = b2)
- ].
- s1 close.
- s2 close.
- same ifTrue:[
- result at:fn1 put:fn2.
- ]
+ result at:fn1 put:fn2.
]
]
]
@@ -4709,14 +4685,19 @@
].
contentsToCompare isNil ifTrue:[
"/ too large - compare block-wise ...
- self halt.
+ contentsMatches := (filenameToCompareContentsOrNil sameContentsAs:f).
] ifFalse:[
- contentsMatches := contentsToCompare = (f binaryContentsOfEntireFile)
+ contentsMatches := contentsToCompare = (f binaryContentsOfEntireFile).
]
].
- ].
+ ] ifFalse:[
+ f isSymbolicLink ifTrue:[
+ subView insertLine:(f name , ' is a symbolic link to ' , f pathName) before:subView cursorLine.
+ subView cursorDown.
+ ]
+ ]
] ifFalse:[
- "/ string search
+ "/ string search ...
(contentsMatches := contentsString isNil) ifFalse:[
(f exists and:[f isReadable]) ifFalse:[
subView insertLine:('*** ' , f pathName , ' skipped - unreadable or bad symbolic link ***') before:subView cursorLine.
@@ -6019,5 +6000,5 @@
!FileBrowser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/Attic/FBrowser.st,v 1.276 1998-11-21 15:16:09 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Attic/FBrowser.st,v 1.277 1998-11-21 15:45:29 cg Exp $'
! !
--- a/FileBrowser.st Sat Nov 21 16:16:09 1998 +0100
+++ b/FileBrowser.st Sat Nov 21 16:45:29 1998 +0100
@@ -1581,40 +1581,16 @@
files := entry asArray.
1 to:files size-1 do:[:idx1 |
idx1+1 to:files size do:[:idx2 |
- |fn1 fn2 s1 s2 b1 b2 n same|
+ |fn1 fn2|
fn1 := files at:idx1.
fn2 := files at:idx2.
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[
"/ compare the files
-
- (fn1 fileSize < (512*1024)) ifTrue:[
- (fn1 binaryContentsOfEntireFile = fn2 binaryContentsOfEntireFile) ifTrue:[
+ (fn1 sameContentsAs:fn2) ifTrue:[
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName.
- result at:fn1 put:fn2.
- ]
- ] ifFalse:[
- "/ compare blockwise ...
- s1 := fn1 readStream binary.
- s2 := fn2 readStream binary.
- b1 := ByteArray new:8192.
- b2 := ByteArray new:8192.
- same := true.
- [same and:[s1 atEnd not]] whileTrue:[
- n := s1 nextBytes:8192 into:b1 startingAt:1.
- s2 nextBytes:n into:b2 startingAt:1.
- n == 8192 ifFalse:[
- b1 from:n+1 to:8192 put:0.
- b2 from:n+1 to:8192 put:0.
- ].
- same := (b1 = b2)
- ].
- s1 close.
- s2 close.
- same ifTrue:[
- result at:fn1 put:fn2.
- ]
+ result at:fn1 put:fn2.
]
]
]
@@ -4709,14 +4685,19 @@
].
contentsToCompare isNil ifTrue:[
"/ too large - compare block-wise ...
- self halt.
+ contentsMatches := (filenameToCompareContentsOrNil sameContentsAs:f).
] ifFalse:[
- contentsMatches := contentsToCompare = (f binaryContentsOfEntireFile)
+ contentsMatches := contentsToCompare = (f binaryContentsOfEntireFile).
]
].
- ].
+ ] ifFalse:[
+ f isSymbolicLink ifTrue:[
+ subView insertLine:(f name , ' is a symbolic link to ' , f pathName) before:subView cursorLine.
+ subView cursorDown.
+ ]
+ ]
] ifFalse:[
- "/ string search
+ "/ string search ...
(contentsMatches := contentsString isNil) ifFalse:[
(f exists and:[f isReadable]) ifFalse:[
subView insertLine:('*** ' , f pathName , ' skipped - unreadable or bad symbolic link ***') before:subView cursorLine.
@@ -6019,5 +6000,5 @@
!FileBrowser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.276 1998-11-21 15:16:09 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.277 1998-11-21 15:45:29 cg Exp $'
! !