A new version of File-Base was added to project Rio: http://www.squeaksource.com/Rio/File-Base-mtf.27.mcz
==================== Summary ====================
Name: File-Base-mtf.27 Author: mtf Time: 11 April 2009, 5:06:11 pm UUID: d479c2e3-7857-4d2b-9572-4bf5d8bfa360 Ancestors: File-Base-mtf.26
refactored home directory to be a method rather than an ivar
=============== Diff against File-Base-mtf.26 ===============
Item was changed: ----- Method: FileFtpExecutive>>isDirectory: (in category 'basic') ----- isDirectory: aRio
+ self ftpDo: [ :ftp | ftp changeDirectoryTo: self homePath, aRio asVmPathName ] ifError: [ :ex | ^ false ]. - self ftpDo: [ :ftp | ftp changeDirectoryTo: home, aRio asVmPathName ] ifError: [ :ex | ^ false ]. ^ true.!
Item was changed: ----- Method: FileFtpExecutive>>deleteFile: (in category 'basic') ----- deleteFile: aRio
self ftpDo: [ :ftp | + (self isFile: aRio) ifTrue: [ ftp deleteFileNamed: self homePath , aRio asVmPathName ] - (self isFile: aRio) ifTrue: [ ftp deleteFileNamed: home , aRio asVmPathName ] ].
aRio statIsNowInvalid.!
Item was added: + ----- Method: Directory class>>home (in category 'as yet unclassified') ----- + home + + ^ self localExecutive homeDirectory!
Item was changed: ----- Method: FileFtpExecutive>>startAt:recursively:select:excluding:into: (in category 'basic') ----- startAt: rioOrString recursively: beRecursive select: selectBlock excluding: xList into: results
"Return a collection of rio's selected by passing the directoryEntry array to the selectBlock. This can be called with startAt: aString, but if so beRecursive must be false. See primLookupEntryIn:index: for further details."
| entry isDir fName |
+ (self ftpGetDirectory: self homePath, rioOrString asVmPathName) keysAndValuesDo: [ :index :entryArray | - (self ftpGetDirectory: home, rioOrString asVmPathName) keysAndValuesDo: [ :index :entryArray |
fName := entryArray at: 1. (xList includes: fName) ifFalse: [
isDir := entryArray at: 4.
entry := ((isDir ifTrue: [ self class dirClass ] ifFalse: [ self class fileClass ]) executive: self value: rioOrString) pathJoin: fName; setStatFromDir: rioOrString andEntryArray:entryArray; yourself.
(selectBlock value: entry) ifTrue: [ results add: entry ]. (beRecursive and: [ isDir ]) ifTrue: [ self startAt: entry recursively: beRecursive select: selectBlock excluding: xList into: results ] ]
]. ^ results!
Item was changed: ----- Method: FileFtpExecutive>>fileSize: (in category 'basic') ----- fileSize: aRio
+ ^ self ftpDo: [ :ftp | ftp getFileSize: self homePath, aRio asVmPathName ] ! - ^ self ftpDo: [ :ftp | ftp getFileSize: home, aRio asVmPathName ] !
Item was changed: ----- Method: FileFtpExecutive>>isFile: (in category 'basic') ----- isFile: aFile
+ self ftpDo: [ :ftp | ftp getFileSize: self homePath, aFile asVmPathName ] ifError: [ :ex | ^ false ]. - self ftpDo: [ :ftp | ftp getFileSize: home, aFile asVmPathName ] ifError: [ :ex | ^ false ]. ^ true.!
Item was changed: ----- Method: FileFtpExecutive>>deleteDirectory: (in category 'basic') ----- deleteDirectory: aRio
self ftpDo: [ :ftp | + ftp deleteDirectory: self homePath, aRio asVmPathName. - ftp deleteDirectory: home, aRio asVmPathName. ].
aRio statIsNowInvalid.!
Item was changed: ----- Method: FileFtpExecutive>>createDirectory: (in category 'basic') ----- createDirectory: aRio
self ftpDo: [ :ftp | + ftp makeDirectory: self homePath, aRio asVmPathName. - ftp makeDirectory: home, aRio asVmPathName. ].
aRio statIsNowInvalid.!
Item was changed: ----- Method: FileFtpExecutive>>ftpOpenForRead: (in category 'ftp client') ----- ftpOpenForRead: aRio
| str | self ftpClient openPassiveDataConnection. + self ftpClient sendCommand: 'RETR ', self homePath , aRio asVmPathName. - self ftpClient sendCommand: 'RETR ', home , aRio asVmPathName. [client checkResponse] on: TelnetProtocolError do: [:ex | client closeDataSocket. ex pass]. "we will wrap a socket for writing" rw := #read. str := SocketStream on: self. aRio isBinary ifTrue: [ str binary ]. ^ str!
Item was changed: ----- Method: FileFtpExecutive>>rename:to: (in category 'basic') ----- rename: aRio to: bRio + self ftpDo: [ :ftp | ftp renameFileNamed: self homePath, aRio asVmPathName to: self homePath, bRio asVmPathName ] - self ftpDo: [ :ftp | ftp renameFileNamed: home, aRio asVmPathName to: home, bRio asVmPathName ] ifError: [ aRio exists ifFalse:[ self error:'Attempt to rename a non-existent file or dir:' , aRio]. bRio exists ifTrue:[ self error: 'Failed to rename, ', bRio,' already exists.' ]. ]. aRio statIsNowInvalid. ^ bRio
!
Item was changed: ----- Method: FileFtpExecutive>>ftpOpenForWrite: (in category 'ftp client') ----- ftpOpenForWrite: aRio
self ftpClient openPassiveDataConnection. + self ftpClient sendCommand: 'STOR ', self homePath , aRio asVmPathName. - self ftpClient sendCommand: 'STOR ', home , aRio asVmPathName. "we will wrap a socket for writing" rw := #write. ^ SocketStream on: self.!
Item was changed: ----- Method: FileFtpExecutive>>touch: (in category 'basic') ----- touch: aRio
+ self ftpDo: [ :ftp | - self ftpDo: [ :dtp | + ftp putFileStreamContents: (WriteStream with: String new) as: self homePath , aRio asVmPathName - ftp putFileStreamContents: (WriteStream with: String new) as: home , aRio asVmPathName ]!
packages@lists.squeakfoundation.org