|
Hi All,
I've made this script to monitor some unwanted dependencys in the
packages of my own. This facilitates migration from D5 to D6.
"Recorre un directorio (y sus subdirectorios) revisando el contenido
de los archivos para
ver si encuentra el pedazo de texto que se le solicite."
tokenDetector := [:file :token| | i fileStream answer|
i := 0.
answer := false.
fileStream := FileStream read: file path text: true.
[ [fileStream atEnd ] whileFalse: [|line|
line := fileStream nextLine.
i := i +1.
(token match: line) ifTrue:[
answer := true.
Transcript nextPutAll: 'Match in line ',i asString,' in ', file
path;cr]]
] ensure:[fileStream close].
answer].
dirFileContentsDetector := nil.
dirFileContentsDetector := [:dirName :token|
File for:'*.*' in: dirName do:[:file |
(file stem ~= '.' and:[file stem ~= '']) ifTrue:[
file isDirectory
ifTrue:[dirFileContentsDetector value: file path value:token]
ifFalse:[ ('*.pac' match:file path) ifTrue:[
(tokenDetector value: file value:token) ifTrue:[
Transcript tab;nextPutAll: 'Match in "',file stem,'"';cr]]].
]
].
].
path := SessionManager current imageBase,'\Herramientas'.
find := '*CU ListTree.pac*'.
dirFileContentsDetector value: path value: find.
Regards,
Sebastián Sastre
|