[Pkg] Rio: File-Kernel-kph.11.mcz
squeak-dev-noreply at lists.squeakfoundation.org
squeak-dev-noreply at lists.squeakfoundation.org
Tue Feb 17 22:36:09 UTC 2009
A new version of File-Kernel was added to project Rio:
http://www.squeaksource.com/Rio/File-Kernel-kph.11.mcz
==================== Summary ====================
Name: File-Kernel-kph.11
Author: kph
Time: 17 February 2009, 10:36:06 pm
UUID: 5550067a-cfc1-4af8-90e4-18d21f40f99b
Ancestors: File-Kernel-test.10
+ isLocal
+ isRemote
tidy
+ instanciate from handles urls
+ some archive support
=============== Diff against File-Kernel-test.10 ===============
Item was added:
+ ----- Method: FileLocalExecutive class>>canInstanciateFrom: (in category 'image start up ') -----
+ canInstanciateFrom: aPathString
+
+ ^ ('file://*' match: aPathString) ifTrue: [ 90 ] ifFalse: [ 0 ]
+ !
Item was changed:
----- Method: FileLocalExecutive>>defaultDirectory (in category 'accessing') -----
defaultDirectory
+ ^ defaultDirectory asDirectory!
- ^ defaultDirectory!
Item was changed:
----- Method: FileLocalDosExecutive>>executiveForVolume: (in category 'accessing') -----
executiveForVolume: requestedRoot
+ ^ self class volumes
- ^ Volumes
detect: [ :i | i isRoot: requestedRoot ]
+ ifNone: [ self class volumes add: (self class basicNew setRootString: requestedRoot; setDefault: nil; yourself) ]!
- ifNone: [ Volumes add: (self class basicNew setRootString: requestedRoot; setDefault: nil; yourself) ]!
Item was changed:
----- Method: FileLocalExecutive class>>initialize (in category 'class initialization') -----
initialize
Smalltalk addToStartUpList: self after: Delay.
- FileLocalDosExecutive initializeVolumes.
Current := self newForThisPlatform.
Current initializeDefault.
!
Item was changed:
----- Method: FileExecutive class>>instanciatorFrom: (in category 'as yet unclassified') -----
instanciatorFrom: aString
+ | executiveClass winner priority |
+
+ winner := 0.
- | executiveClass |
+ self instanciatorBase allSubclassesDo: [ :c |
+ priority := c canInstanciateFrom: aString.
+ priority > winner ifTrue: [ winner := priority.
+ executiveClass := c ] ].
- FileExecutive allSubclassesDo: [ :c | (c canInstanciateFrom: aString) ifTrue: [ executiveClass := c ]].
^ executiveClass ifNil: [ self default ]!
Item was added:
+ ----- Method: FileExecutive>>toDir:addAllFromArchive:relativeTo: (in category 'local/remote file copy') -----
+ toDir: aDir addAllFromArchive: someFD relativeTo: aBaseDir
+
+ ^ someFD first executive toDirLocal: aDir addAllFromArchive: someFD relativeTo: aBaseDir.!
Item was changed:
----- Method: FileLocalDosExecutive class>>executiveForVolume: (in category 'as yet unclassified') -----
executiveForVolume: theRequestedRoot
| requestedRoot |
requestedRoot := theRequestedRoot.
requestedRoot = nil ifTrue: [ requestedRoot := 'C:/' ].
+ ^ self volumes
- ^ Volumes
detect: [ :i | i isRoot: requestedRoot ]
+ ifNone: [ self volumes add: (self basicNew setRootString: requestedRoot; setDefault: nil; yourself) ]!
- ifNone: [ Volumes add: (self basicNew setRootString: requestedRoot; setDefault: nil; yourself) ]!
Item was changed:
----- Method: FileExecutive class>>canInstanciateFrom: (in category 'as yet unclassified') -----
canInstanciateFrom: aPathString
+ "we return 0, because we do not support any specific protocol"
+
+ ^ 0!
- "we return false, because we do not support any specific protocol"
-
- ^ false!
Item was added:
+ ----- Method: FileExecutive>>isRemote (in category 'as yet unclassified') -----
+ isRemote
+
+ ^ false!
Item was changed:
----- Method: FileExecutive>>basicWriter: (in category 'as yet unclassified') -----
basicWriter: aRio
+ aRio statIsNowInvalid.
^ self class fileStreamClass new open: aRio forWrite: true
!
Item was added:
+ ----- Method: FileExecutive>>isLocal (in category 'as yet unclassified') -----
+ isLocal
+
+ ^ self isRemote not!
Item was changed:
FileLocalCaseInsensitiveExecutive subclass: #FileLocalDosExecutive
instanceVariableNames: ''
+ classVariableNames: ''
- classVariableNames: 'Volumes'
poolDictionaries: ''
category: 'File-Kernel'!
+ FileLocalDosExecutive class
+ instanceVariableNames: 'volumes'!
!FileLocalDosExecutive commentStamp: 'kph 4/17/2007 19:19' prior: 0!
The initial idea was to model things properly as a file within a named volume, on unix there would be one executive for the whole system. On dos there would be one executive per volume.!
Item was changed:
----- Method: FileLocalDosExecutive class>>makeNew:from: (in category 'as yet unclassified') -----
+ makeNew: aClass from: path
- makeNew: aClass from: str
+ | rioDrive exec str |
+
+ str := (path beginsWith: 'file:///') ifTrue: [ (path allButFirst: 8) unescapePercents ] ifFalse: [ path ].
- | rioDrive exec |
rioDrive := nil.
(str size > 1) ifTrue: [
(str second = $:) ifTrue: [ rioDrive := (str first: 2) , self pathDelimiter ].
].
exec := self executiveForVolume: rioDrive.
^ aClass executive: exec value: str!
Item was changed:
----- Method: FileLocalDosExecutive>>initializeDefault (in category 'as yet unclassified') -----
initializeDefault
self setRootString: (self primImagePath first: 3);
setDefault: self getDefaultDirectory.
+ self class volumes add: self.!
- Volumes add: self.!
Item was changed:
----- Method: FileLocalExecutive class>>makeNew:from: (in category 'as yet unclassified') -----
+ makeNew: aClass from: path
+
+ | str |
+
+ str := (path beginsWith: 'file:///') ifTrue: [ (path allButFirst: 8) unescapePercents ] ifFalse: [ path ].
- makeNew: aClass from: aString
+ ^ aClass executive: self current value: str !
- ^ aClass executive: self current value: aString !
Item was added:
+ ----- Method: FileLocalDosExecutive class>>volumes (in category 'as yet unclassified') -----
+ volumes
+
+ ^ volumes ifNil: [ volumes := Set new ]!
Item was changed:
----- Method: FileLocalExecutive>>setDefault: (in category 'executive actions') -----
setDefault: d
+ "store default directory as a string, otherwise storeOn: is recursive"
+
+ defaultDirectory := d asString!
- defaultDirectory := d!
Item was added:
+ ----- Method: FileExecutive class>>instanciatorBase (in category 'as yet unclassified') -----
+ instanciatorBase
+
+ ^ FileExecutive!
Item was changed:
----- Method: FileExecutive class>>OSProcessOrNil (in category 'as yet unclassified') -----
OSProcessOrNil
-
- "extra check is needed because OSProcess on windows does not support waitForCommand (yet)"
-
- | osp |
+ ^ Smalltalk at: #OSProcess ifAbsent: [ ^ nil ].
- osp := Smalltalk at: #OSProcess ifAbsent: [ ^ nil ].
- ^ (osp thisOSProcess respondsTo: #waitForCommand:) ifTrue: [ osp ] ifFalse: [ nil ]
!
Item was changed:
----- Method: FileLocalDosExecutive class>>canInstanciateFrom: (in category 'as yet unclassified') -----
canInstanciateFrom: aString
+ ^ (('file:///#:*' match: aString) or: [ '#:*' match: aString ]) ifTrue: [ 100 ] ifFalse: [ 0 ]
+
+ !
- ^ (aString size > 1 and: [ aString second = $: ])!
Item was removed:
- ----- Method: FileLocalDosExecutive>>makeNewRioFrom: (in category 'fs migration') -----
- makeNewRioFrom: aString
-
- | rioDrive exec str |
-
- str := aString.
- exec := self.
-
- (aString size > 1) ifTrue: [
-
- rioDrive := rootString.
- (str second = $:) ifTrue: [ rioDrive := (str first: 2) , self pathDelimiter ].
-
- rioDrive ~= rootString ifTrue: [ exec := self executiveForVolume: rioDrive ].
-
- ].
-
- ^ exec fileClass executive: exec value: str!
Item was removed:
- ----- Method: FileLocalDosExecutive class>>initializeVolumes (in category 'as yet unclassified') -----
- initializeVolumes
-
- Volumes := Set new !
Item was removed:
- ----- Method: FileExecutive>>makeNewRioFromString: (in category 'as yet unclassified') -----
- makeNewRioFromString: aString
-
- ^ self fileClass executive: self value: aString !
Item was removed:
- ----- Method: FileLocalDosExecutive>>makeNewFrom: (in category 'fs migration') -----
- makeNewFrom: aString
-
- | rioDrive exec str |
-
- str := aString.
- exec := self.
-
- (aString size > 1) ifTrue: [
-
- rioDrive := rootString.
- (str second = $:) ifTrue: [ rioDrive := (str first: 2) , self pathDelimiter ].
-
- rioDrive ~= rootString ifTrue: [ exec := self executiveForVolume: rioDrive ].
-
- ].
-
- ^ exec fileClass executive: exec value: str!
More information about the Packages
mailing list