A new version of File-Base was added to project Rio: http://www.squeaksource.com/Rio/File-Base-kph.26.mcz
==================== Summary ====================
Name: File-Base-kph.26 Author: kph Time: 11 April 2009, 11:26:48 pm UUID: 1a08fcda-b9eb-4a14-93d3-55abaa56b407 Ancestors: File-Base-kph.25
FileJpeg
Instanciate file class based on extn
=============== Diff against File-Base-kph.25 ===============
Item was changed: ----- Method: Directory>>asFile (in category 'directory/container actions') ----- asFile
+ ^ self as: (File classForPathWithExtension: value) ! - ^ self as: File!
Item was added: + ----- Method: FilePng class>>validExtensions (in category 'as yet unclassified') ----- + validExtensions + + ^ #( 'png' )!
Item was added: + ----- Method: FileJpeg class>>validExtensions (in category 'as yet unclassified') ----- + validExtensions + + ^ #( 'jpeg' 'jpg' )!
Item was changed: ----- Method: String>>asFile (in category '*file-base') ----- asFile
+ ^ ((File classForPathWithExtension: self) "ifNil: [ File ]") new: self! - ^ ((File classForPathWithExtension: self) ifNil: [ File ]) new: self!
Item was changed: ----- Method: File class>>classForPathWithExtension: (in category 'documentation') ----- classForPathWithExtension: aPath
| ext | ext := aPath copyAfterLast: $.. self allSubclassesDo: [ :c | (c validExtensions includes: ext) ifTrue: [ ^ c ] ]. + ^ File - ^ nil !
Item was added: + File subclass: #FileJpeg + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'File-Base'!
Item was added: + ----- Method: File>>extent (in category 'public modes') ----- + extent + "for compatability with FileJpeg" + ^ nil!
Item was added: + ----- Method: FileJpeg>>extent (in category 'as yet unclassified') ----- + extent + + | ext | + self beBinary reader: [ :str | + + ext := JPEGReadWriter2 new imageExtent: (str next: 600) + ]. + + ((ext x = 0) and: [ ext y = 0 ]) ifTrue: [ ^ nil ]. + + ^ ext!
Item was added: + File subclass: #FilePng + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'File-Base'!
packages@lists.squeakfoundation.org