[Pkg] Rio: File-Base-kph.29.mcz

squeak-dev-noreply at lists.squeakfoundation.org squeak-dev-noreply at lists.squeakfoundation.org
Mon Jul 13 03:50:21 UTC 2009


A new version of File-Base was added to project Rio:
http://www.squeaksource.com/Rio/File-Base-kph.29.mcz

==================== Summary ====================

Name: File-Base-kph.29
Author: kph
Time: 13 July 2009, 4:50:19 am
UUID: 944dc690-8ac5-4182-a508-f655750624ad
Ancestors: File-Base-kph.23

+ ifAbsent:
+ error raised if remote to local file copy doesnt arrive

=============== Diff against File-Base-kph.23 ===============

Item was changed:
  ----- Method: File>>ifAbsentDo: (in category 'testing') -----
  ifAbsentDo: aBlock
  
+ 	^ self exists ifFalse: [ aBlock value: self ] ifTrue: [ self ]!
- 	^ self exists not ifTrue: [ aBlock value: self ] ifFalse: [ self ]!

Item was added:
+ ----- Method: File>>ifAbsent: (in category 'testing') -----
+ ifAbsent: aBlock
+ 
+ 	^ self exists ifFalse: [ aBlock value: self ] ifTrue: [ self ]!

Item was changed:
  ----- Method: FileFtpExecutive>>copyUsing:from:to:relativeTo: (in category 'local/remote file copy') -----
  copyUsing: aSelector from: aDir to: someFD relativeTo: aBaseDir
  
  	"here we do two passes, first we ensure that all of the needed directories exist.
  	 for this we use our ususal ftp client.
  	
  	for the file transfers themselves we run n threads feeding from a shared queue
  	
  	"
  
  	| queue map done delay flg dest transfers |
  	
  	flg := FileNotification isOverwrite.
  
  	self ftpDo: [ :ftp |
+ 	
  		map := self toDir: aDir mkpathAll: someFD relativeTo: aBaseDir.
  		
  		transfers := map select: [ :ea | 
  			dest := ea value.
  			dest isDirectory not and: [ flg or: [ dest exists not ] ]
  		]
  	].
  
  	delay := Delay forMilliseconds: 100.
  	queue := SharedQueue2 new setItems: transfers copy.
  	done :=  SharedQueue2 new.
  	
   	
  	self class prefFtpParallel timesRepeat: [
  			[
  				[ queue isEmpty ] whileFalse: [ 
  					queue nextOrNil ifNotNilDo: [ :ea | 
  						[ self perform: aSelector with: ea key with: ea value ] ensure: [ done nextPut: ea ].
  					]
  				]
  			] fork.
  		].
  	
  	[ done size < transfers size ] whileTrue: [ delay wait ]. 
   
  	"return all the destinations"
  	^ map collect: [ :ea | ea value ]
   !

Item was changed:
+ ----- Method: FileFtpExecutive>>copyRemoteFile:toLocalFile: (in category 'ftp client') -----
- ----- Method: FileFtpExecutive>>copyRemoteFile:toLocalFile: (in category 'external ftp') -----
  copyRemoteFile: aFile toLocalFile: bFile 
+ 	| cmd |
+ 	
- 
  	File 
   		ospIfWin:[ :os | aFile copyTo: bFile ]
+ 		ifUnix: [ :os | 
+ 			os waitForCommand: (cmd := 'ftp -o "', bFile asVmPathName, '" "' ,  url asString ,  aFile, '"').
+ 			bFile exists ifFalse: [ self error: 'transfer failed: ', cmd]. ]
- 		ifUnix: [ :os | os waitForCommand: 'ftp -o "', bFile asVmPathName, '" "' ,  url asString ,  aFile, '"' ]
  		ifNone: [ aFile copyTo: bFile ]
  	
   !



More information about the Packages mailing list