A new version of File-Base was added to project Rio: http://www.squeaksource.com/Rio/File-Base-kph.19.mcz
==================== Summary ====================
Name: File-Base-kph.19 Author: kph Time: 2 March 2009, 8:35:23 pm UUID: a79dbc77-0769-11de-a0af-000a95edb42a Ancestors: File-Base-kph.18
all test pass on unix
=============== Diff against File-Base-kph.18 ===============
Item was changed: ----- Method: File>>renameTo: (in category 'public file') ----- renameTo: rioable + ^ executive rename: self to: (rioable as: File)! - ^ executive rename: self to: rioable asFile!
Item was changed: FileRemoteExecutive subclass: #FileFtpExecutive + instanceVariableNames: 'isKeepAlive rw' - instanceVariableNames: 'home isKeepAlive rw' classVariableNames: '' poolDictionaries: '' category: 'File-Base'!
Item was changed: ----- Method: FileArchiveExecutive>>root (in category 'as yet unclassified') ----- root
+ ^ self class pathDelimiter - ^ self pathDelimiter !
Item was changed: ----- Method: FileFtpExecutive>>copyLocalFile:toRemoteFile: (in category 'external ftp') ----- copyLocalFile: aFile toRemoteFile: bFile
+ File + ospIfWin:[ :os | aFile copyTo: bFile ] + ifUnix: [ :os | os waitForCommand: 'ftp -u "', url asString , bFile , '" "' , aFile asVmPathName ,'"' ] + ifNone: [ aFile copyTo: bFile ] - self class OSProcessOrNil ifNil: [ ^ aFile copyTo: bFile ]. - - self class OSProcessOrNil waitForCommand: + ! - 'ftp -u "', url asString , bFile , '" "' , aFile asVmPathName ,'"' !
Item was changed: ----- Method: File>>renamingWith: (in category 'private') ----- renamingWith: aBlock
+ | old | + self isRenaming + ifTrue: [ old := self copy. + aBlock value. + self parent mkpath. + old renameTo: self ] + ifFalse: [ aBlock value ]. + + - ^ self isRenaming - ifTrue: [ self copy renameTo: aBlock value ] - ifFalse: [ aBlock value ] !
Item was changed: ----- Method: FileFtpExecutive>>ftpOpenClient (in category 'ftp client') ----- ftpOpenClient
| loginSuccessful what newClient | newClient := self FTPClient openOnHostNamed: self host. loginSuccessful := false. [loginSuccessful] whileFalse: [ [loginSuccessful := true. newClient loginUser: self user password: self password] on: LoginFailedException do: [:ex | what := UIManager default chooseFrom: #('enter password' 'give up') title: 'Would you like to try another password?'. what = 1 ifFalse: [self error: 'Login failed.'. ^nil] ifTrue: [ self password: nil ]. loginSuccessful := false]]. + self setHome: newClient pwd. - home := newClient pwd. ^ newClient!
Item was changed: ----- Method: File>>full: (in category 'public path') ----- full: aPathOrFile
^ self renamingWith: [ + value := executive importValue: (aPathOrFile asFile linearRelativeTo: executive homeDirectory) asString. - value := executive importValue: (aPathOrFile asFile linearRelativeTo: executive defaultDirectory) asString. ] !
Item was changed: ----- Method: FileFtpExecutive>>copyRemoteFile:toLocalFile: (in category 'external ftp') ----- copyRemoteFile: aFile toLocalFile: bFile
+ File + ospIfWin:[ :os | aFile copyTo: bFile ] + ifUnix: [ :os | os waitForCommand: 'ftp -o "', bFile asVmPathName, '" "' , url asString , aFile, '"' ] + ifNone: [ aFile copyTo: bFile ] - self class OSProcessOrNil ifNil: [ ^ aFile copyTo: bFile ]. - - self class OSProcessOrNil waitForCommand: + ! - 'ftp -o "', bFile asVmPathName, '" "' , url asString , aFile, '"'!
Item was added: + ----- Method: File class>>ospIfWin:ifUnix:ifNone: (in category 'documentation') ----- + ospIfWin: winBlock ifUnix: unixBlock ifNone: noneBlock + | os | + + os := (Smalltalk at: #OSProcess ifAbsent: [ ^ noneBlock value ]) thisOSProcess. + + os pid ifNil: [ ^ noneBlock value ]. + + os class = WindowsProcess ifTrue: [ ^ winBlock value: os ]. + os class = UnixProcess ifTrue: [ ^ unixBlock value: os ].!
Item was added: + ----- Method: File class>>ifWin:ifUnix:ifNone: (in category 'documentation') ----- + ifWin: winBlock ifUnix: unixBlock ifNone: noneBlock + | os | + + os := (Smalltalk at: #OSProcess ifAbsent: [ ^ noneBlock value ]) thisOSProcess. + + os pid ifNil: [ ^ noneBlock value ]. + + os class = WindowsProcess ifTrue: [ ^ winBlock value ]. + os class = UnixProcess ifTrue: [ ^ unixBlock value ].!
Item was removed: - ----- Method: FileFtpExecutive>>externalFtp:from:to: (in category 'external ftp') ----- - externalFtp: getOrPut from: aFile to: bFile - - File tmpDo: [ :cmds | - - cmds writer: [ :str | - str << 'open ' << self host; cr. - str << 'user ' << self user << ' ' << self password; cr. - str << 'binary' ; cr. - str << getOrPut << ' "' << aFile << '" "' << bFile << '"' ; cr. - str << 'quit' ; cr. - ]. - - self class OSProcessOrNil waitForCommand: 'ftp -ig -s:' , cmds asVmPathName. - - ].!
packages@lists.squeakfoundation.org