FileBrowser.st
changeset 14499 44b03221ff92
parent 14467 b048bbcddb92
child 14606 3269a6c61a23
equal deleted inserted replaced
14498:16ebee6b698d 14499:44b03221ff92
  2138     self fileSelect:lineNr.
  2138     self fileSelect:lineNr.
  2139     self fileGet:true
  2139     self fileGet:true
  2140 !
  2140 !
  2141 
  2141 
  2142 fileEncoding
  2142 fileEncoding
  2143     "open a dialog to allow change of the files character encoding.
  2143     "open a dialog to allow change of the file's character encoding.
  2144      Files are converted to internal encoding when read, and converted back
  2144      Files are converted to internal encoding when read, and converted back
  2145      to this encoding when saved.
  2145      to this encoding when saved.
  2146      The default encoding is nil, which means that files are already in
  2146      The default encoding is nil, which means that files are already in
  2147      the internal encoding (which is iso8859).
  2147      the internal encoding (which is iso8859).
  2148      Notice: currently, not too many encodings are supported by the system."
  2148      Notice: currently, not too many encodings are supported by the system."
  2462         infoDir := Dictionary new.
  2462         infoDir := Dictionary new.
  2463         fileNames do:[:fn |
  2463         fileNames do:[:fn |
  2464             infoDir at:fn put:(fn fileSize)
  2464             infoDir at:fn put:(fn fileSize)
  2465         ].
  2465         ].
  2466 
  2466 
  2467         "/ for each, get the files size.
  2467         "/ for each, get the file's size.
  2468         "/ in a first pass, look for files of the same size and
  2468         "/ in a first pass, look for files of the same size and
  2469         "/ compare them ...
  2469         "/ compare them ...
  2470 
  2470 
  2471         self label:myName , '- preselect possible duplicates ...'.
  2471         self label:myName , '- preselect possible duplicates ...'.
  2472         filesBySize := Dictionary new.
  2472         filesBySize := Dictionary new.
  2561         infoDir := Dictionary new.
  2561         infoDir := Dictionary new.
  2562         fileNames do:[:fn |
  2562         fileNames do:[:fn |
  2563             infoDir at:fn put:(fn info)
  2563             infoDir at:fn put:(fn info)
  2564         ].
  2564         ].
  2565 
  2565 
  2566         "/ for each, get the files size.
  2566         "/ for each, get the file's size.
  2567         "/ in a first pass, look for files of the same size and
  2567         "/ in a first pass, look for files of the same size and
  2568         "/ compare them ...
  2568         "/ compare them ...
  2569 
  2569 
  2570         filesBySize := Dictionary new.
  2570         filesBySize := Dictionary new.
  2571         infoDir keysAndValuesDo:[:fn :info |
  2571         infoDir keysAndValuesDo:[:fn :info |
  5942     "Modified: 22.2.1996 / 14:57:08 / cg"
  5942     "Modified: 22.2.1996 / 14:57:08 / cg"
  5943 !
  5943 !
  5944 
  5944 
  5945 readFile:fileName lineDelimiter:aCharacter encoding:encoding
  5945 readFile:fileName lineDelimiter:aCharacter encoding:encoding
  5946     "read in the file, return its contents as StringCollection. 
  5946     "read in the file, return its contents as StringCollection. 
  5947      The files lines are delimited by aCharacter.
  5947      The file's lines are delimited by aCharacter.
  5948      If encoding is nonNil, the file is assumed to be coded according to
  5948      If encoding is nonNil, the file is assumed to be coded according to
  5949      that symbol, and #decodeString: should be able to convert it."
  5949      that symbol, and #decodeString: should be able to convert it."
  5950 
  5950 
  5951     |f stream text msg sz|
  5951     |f stream text msg sz|
  5952 
  5952 
  5986     "Modified: 22.2.1996 / 14:58:40 / cg"
  5986     "Modified: 22.2.1996 / 14:58:40 / cg"
  5987 !
  5987 !
  5988 
  5988 
  5989 readStream:aStream lineDelimiter:aCharacter encoding:fileEncodingArg 
  5989 readStream:aStream lineDelimiter:aCharacter encoding:fileEncodingArg 
  5990     "read from aStream, answer its contents as StringCollection. 
  5990     "read from aStream, answer its contents as StringCollection. 
  5991      The files lines are delimited by aCharacter.
  5991      The file's lines are delimited by aCharacter.
  5992      If encoding is nonNil, the file is assumed to be coded according to
  5992      If encoding is nonNil, the file is assumed to be coded according to
  5993      that symbol, and #decodeString: should be able to convert it."
  5993      that symbol, and #decodeString: should be able to convert it."
  5994 
  5994 
  5995     |text line fileEncoding editorsEncoding encoder|
  5995     |text line fileEncoding editorsEncoding encoder|
  5996 
  5996 
  7441 ! !
  7441 ! !
  7442 
  7442 
  7443 !FileBrowser class methodsFor:'documentation'!
  7443 !FileBrowser class methodsFor:'documentation'!
  7444 
  7444 
  7445 version
  7445 version
  7446     ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.661 2014-06-06 07:30:25 stefan Exp $'
  7446     ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.662 2014-06-14 09:06:50 cg Exp $'
  7447 !
  7447 !
  7448 
  7448 
  7449 version_CVS
  7449 version_CVS
  7450     ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.661 2014-06-06 07:30:25 stefan Exp $'
  7450     ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.662 2014-06-14 09:06:50 cg Exp $'
  7451 ! !
  7451 ! !
  7452 
  7452