[Pkg] Rio: File-Kernel-kph.2.mcz

squeak-dev-noreply at lists.squeakfoundation.org squeak-dev-noreply at lists.squeakfoundation.org
Mon Nov 24 11:30:51 UTC 2008


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

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

Name: File-Kernel-kph.2
Author: kph
Time: 24 November 2008, 11:30:49 am
UUID: 63a5fedf-3dd6-4141-afec-bfbafc465920
Ancestors: File-Kernel-kph.1

- rename FileDirStat to FileStat
- support for using double dispatch to pick the write method for file transfers, local to remote, local to local, remote to local, or remote to remote.

=============== Diff against File-Kernel-kph.1 ===============

Item was added:
+ ----- Method: FileStat>>rio (in category 'as yet unclassified') -----
+ rio
+ 
+ 	^ dir / self fileName!

Item was added:
+ ----- Method: FileLocalExecutive>>copyLocalFile:toLocalFile: (in category 'as yet unclassified') -----
+ copyLocalFile: aFile toLocalFile: bFile
+ 
+ 	self class OSProcessOrNil ifNotNilDo: [ :osp | osp waitForCommand: 'cp "', aFile asVmPathName, '" "', bFile asVmPathName, '"'. ^ aFile].
+ 
+ 	(self primCopyFile: aFile asVmPathName to: bFile asVmPathName) = #failed ifTrue: [ ^ aFile copyTo: bFile ].
+ 
+ 	^ aFile
+ 
+ !

Item was added:
+ ----- Method: FileStat>>isValid (in category 'as yet unclassified') -----
+ isValid
+ 
+ 	^ dir notNil!

Item was added:
+ ----- Method: FileExecutive>>dir:mkpath:fromBase: (in category 'as yet unclassified') -----
+ dir: aDir mkpath: aFileOrDir fromBase: aBaseDirectory
+ 	
+ 	| newFD |
+ 	
+ 	newFD := aBaseDirectory ifNil: [ aFileOrDir ]
+ 				    		 	 ifNotNil: [ aDir / (aFileOrDir linearRelativeTo: aBaseDirectory) ].
+ 
+  	aFileOrDir isDirectory ifTrue: [ ^ newFD mkpath ]. 
+ 	aFileOrDir isFile ifTrue: [ ^ newFD parent mkpath ].
+ 	
+ 	
+  !

Item was added:
+ ----- Method: FileStat>>isInvalid (in category 'as yet unclassified') -----
+ isInvalid
+ 
+ 	^ dir isNil!

Item was changed:
  FileExecutive subclass: #FileLocalExecutive
+ 	instanceVariableNames: 'rootString root defaultDirectory newRio'
- 	instanceVariableNames: 'rootString root defaultDirectory'
  	classVariableNames: 'Current Test'
  	poolDictionaries: ''
  	category: 'File-Kernel'!
  
  !FileLocalExecutive commentStamp: 'kph 4/17/2007 19:25' prior: 0!
  Introducing the idea that Rio's exist in the context of their 'physical container', we have the RioLocalFileSystem as the primary container which provides the file system interface, also known as the 'executive'.
  
  On unix there is one executive for the whole system. On dos there is one executive per volume. This approach also supports the notion of files within archives and files on remote servers.
  
  On startup, having a formal model of the host filesystem allows us to keep a current and previous instance introducing the possibility for migrating Rio's on startup when the image has been moved. For example C:/ could be replaced with /mnt/hda1 thus attempting to make images properly portable. (experimental idea)
  
  !

Item was added:
+ ----- Method: FileLocalExecutive>>copyFile:toLocalFile: (in category 'as yet unclassified') -----
+ copyFile: aFile toLocalFile: bFile
+ 	
+ 	^ self copyLocalFile: aFile toLocalFile: bFile
+ 	!

Item was added:
+ ----- Method: FileLocalExecutive>>copyFile:toRemoteFile: (in category 'as yet unclassified') -----
+ copyFile: aFile toRemoteFile: bFile
+ 
+ 	^ bFile executive copyLocalFile: aFile toRemoteFile: bFile!

Item was added:
+ ----- Method: FileStat>>creationTime (in category 'as yet unclassified') -----
+ creationTime
+ 
+ ^ self cTime!

Item was added:
+ ----- Method: FileStat class>>in:array: (in category 'as yet unclassified') -----
+ in: dirRio array: theArray
+ 
+ 	^ self new setDir: dirRio array: theArray!

Item was added:
+ ----- Method: FileLocalExecutive>>toUrl: (in category 'executive actions') -----
+ toUrl: aFD
+ 
+ 	^ FileUrl new initializeFromPathString: (aFD full value replacing: $\ with: $/)!

Item was added:
+ ----- Method: FileExecutive>>dir:addAll:fromBase: (in category 'executive actions') -----
+ dir: aDir addAll: someFD fromBase: aBaseDir
+ 	
+ 	someFD do: [ :each | self dir: aDir add: each fromBase: aBaseDir ]!

Item was added:
+ ----- Method: FileStat>>mTime (in category 'as yet unclassified') -----
+ mTime
+ 
+ ^ TimeStamp fromSeconds: self mTimeInSeconds
+ 
+ !

Item was added:
+ ----- Method: FileLocalExecutive>>dir:addFile: (in category 'executive actions') -----
+ dir: aDir addFile: aFile
+ 
+ 	^ aFile executive copyFile: aFile toLocalFile: aDir / aFile fileName
+ 	
+  !

Item was added:
+ ----- Method: FileStat>>isDirectory (in category 'as yet unclassified') -----
+ isDirectory
+ 
+ ^(array at: 4)!

Item was added:
+ ----- Method: FileStat>>cTime (in category 'as yet unclassified') -----
+ cTime
+ 
+ ^ TimeStamp fromSeconds: self cTimeInSeconds!

Item was added:
+ ----- Method: FileStat>>fileName (in category 'as yet unclassified') -----
+ fileName
+ 
+ ^array at: 1!

Item was added:
+ ----- Method: FileStat>>setDir:array: (in category 'as yet unclassified') -----
+ setDir: aDir array: data
+ 
+ 	dir := aDir.
+ 	array := data.!

Item was added:
+ ----- Method: FileStat>>modificationTime (in category 'as yet unclassified') -----
+ modificationTime
+ 
+ ^ self mTime!

Item was added:
+ ----- Method: FileStat>>invalidate (in category 'as yet unclassified') -----
+ invalidate
+ 	
+ 	array := nil.!

Item was added:
+ ----- Method: FileExecutive>>dir:add: (in category 'as yet unclassified') -----
+ dir: aDir add: aFileOrDir 
+  
+ 	aFileOrDir isFile ifTrue: [ self dir: aDir addFile: aFileOrDir ].
+ 	
+  !

Item was changed:
  ----- Method: FileKernel>>setStatFromDir:andEntryArray: (in category 'accessing') -----
  setStatFromDir: dir andEntryArray: a 
  	
+ 	stat := FileStat in: dir array: a
- 	stat := FileDirStat in: dir array: a
  !

Item was added:
+ ----- Method: FileLocalExecutive>>primCopyFile:to: (in category 'executive actions') -----
+ primCopyFile: srcName to: dstName 
+ 	"Copied from VMMaker code.
+ 	This really ought to be a facility in file system. The major annoyance 
+ 	here is that file types and permissions are not handled by current 
+ 	Squeak code.
+ 	NOTE that this will clobber the destination file!!"
+ 	<primitive: 'primitiveFileCopyNamedTo' module:'FileCopyPlugin'> "primitiveExternalCall" 
+ 
+ 	^ #failed!

Item was added:
+ ----- Method: FileStat>>isFile (in category 'as yet unclassified') -----
+ isFile
+ 
+ ^self isDirectory not!

Item was added:
+ Object subclass: #FileStat
+ 	instanceVariableNames: 'array dir'
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'File-Kernel'!
+ 
+ !FileStat commentStamp: 'kph 3/8/2007 02:52' prior: 0!
+ A RioDirEntry is a wrapper for the results of primLookup to be more user friendly. For example modification times are avalable as squeak DateAndTime instances.
+  !

Item was added:
+ ----- Method: FileStat>>fileSize (in category 'as yet unclassified') -----
+ fileSize
+ 
+ ^ array at: 5!

Item was added:
+ ----- Method: FileStat>>dir (in category 'as yet unclassified') -----
+ dir
+ 
+ 	^ dir!

Item was added:
+ ----- Method: FileStat>>cTimeInSeconds (in category 'as yet unclassified') -----
+ cTimeInSeconds
+ 
+ ^ array at: 2!

Item was added:
+ ----- Method: FileStat>>mTimeInSeconds (in category 'as yet unclassified') -----
+ mTimeInSeconds
+ 
+ ^ array at: 3!

Item was added:
+ ----- Method: FileExecutive>>dir:add:fromBase: (in category 'as yet unclassified') -----
+ dir: aDir add: aFileOrDir fromBase: aBaseDirectory
+ 	
+ 	| dir |
+ 	
+ 	dir := self dir: aDir mkpath: aFileOrDir fromBase: aBaseDirectory.
+ 
+ 	self dir: dir add: aFileOrDir.
+ 	
+  !

Item was added:
+ ----- Method: FileExecutive class>>OSProcessOrNil (in category 'as yet unclassified') -----
+ OSProcessOrNil
+ 
+ 	"extra check is needed because OSProcess on windows does not support waitForCommand (yet)"
+ 	
+ 	| osp |
+ 	
+ 	osp := Smalltalk at: #OSProcess ifAbsent: [ ^ nil ].
+ 	
+ 	^ (osp thisOSProcess respondsTo: #waitForCommand:) ifTrue: [ osp ] ifFalse: [ nil ]
+ 	!

Item was removed:
- Object subclass: #FileDirStat
- 	instanceVariableNames: 'array dir'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'File-Kernel'!
- 
- !FileDirStat commentStamp: 'kph 3/8/2007 02:52' prior: 0!
- A RioDirEntry is a wrapper for the results of primLookup to be more user friendly. For example modification times are avalable as squeak DateAndTime instances.
-  !

Item was removed:
- ----- Method: FileDirStat>>creationTime (in category 'as yet unclassified') -----
- creationTime
- 
- ^ self cTime!

Item was removed:
- ----- Method: FileDirStat>>dir (in category 'as yet unclassified') -----
- dir
- 
- 	^ dir!

Item was removed:
- ----- Method: FileDirStat>>fileName (in category 'as yet unclassified') -----
- fileName
- 
- ^array at: 1!

Item was removed:
- ----- Method: FileDirStat>>modificationTime (in category 'as yet unclassified') -----
- modificationTime
- 
- ^ self mTime!

Item was removed:
- ----- Method: FileDirStat>>invalidate (in category 'as yet unclassified') -----
- invalidate
- 	
- 	array := nil.!

Item was removed:
- ----- Method: FileDirStat>>isFile (in category 'as yet unclassified') -----
- isFile
- 
- ^self isDirectory not!

Item was removed:
- ----- Method: FileDirStat>>fileSize (in category 'as yet unclassified') -----
- fileSize
- 
- ^ array at: 5!

Item was removed:
- ----- Method: FileDirStat>>cTimeInSeconds (in category 'as yet unclassified') -----
- cTimeInSeconds
- 
- ^ array at: 2!

Item was removed:
- ----- Method: FileDirStat>>mTimeInSeconds (in category 'as yet unclassified') -----
- mTimeInSeconds
- 
- ^ array at: 3!

Item was removed:
- ----- Method: FileDirStat>>rio (in category 'as yet unclassified') -----
- rio
- 
- 	^ dir / self fileName!

Item was removed:
- ----- Method: FileDirStat>>isValid (in category 'as yet unclassified') -----
- isValid
- 
- 	^ dir notNil!

Item was removed:
- ----- Method: FileDirStat class>>in:array: (in category 'as yet unclassified') -----
- in: dirRio array: theArray
- 
- 	^ self new setDir: dirRio array: theArray!

Item was removed:
- ----- Method: FileDirStat>>mTime (in category 'as yet unclassified') -----
- mTime
- 
- ^ TimeStamp fromSeconds: self mTimeInSeconds
- 
- !

Item was removed:
- ----- Method: FileDirStat>>isDirectory (in category 'as yet unclassified') -----
- isDirectory
- 
- ^(array at: 4)!

Item was removed:
- ----- Method: FileDirStat>>isInvalid (in category 'as yet unclassified') -----
- isInvalid
- 
- 	^ dir isNil!

Item was removed:
- ----- Method: FileDirStat>>cTime (in category 'as yet unclassified') -----
- cTime
- 
- ^ TimeStamp fromSeconds: self cTimeInSeconds!

Item was removed:
- ----- Method: FileDirStat>>setDir:array: (in category 'as yet unclassified') -----
- setDir: aDir array: data
- 
- 	dir := aDir.
- 	array := data.!



More information about the Packages mailing list