[squeak-dev] The Trunk: Files-eem.82.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Jul 6 20:53:56 UTC 2010
Eliot Miranda uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-eem.82.mcz
==================== Summary ====================
Name: Files-eem.82
Author: eem
Time: 6 July 2010, 1:53:45.947 pm
UUID: 07fec7a1-4276-4638-b19b-9e8de1e5e079
Ancestors: Files-mtf.81
File name correction for unix to allow e.g. filing out
categories containing '/' such as fileIn/Out.
Neaten detectFile:do:
=============== Diff against Files-mtf.81 ===============
Item was added:
+ ----- Method: UnixFileDirectory>>checkName:fixErrors: (in category 'file names') -----
+ checkName: aFileName fixErrors: fixing
+ "Check if the file name contains any invalid characters"
+ | fName |
+ fName := super checkName: aFileName fixErrors: fixing.
+ (fName includes: self class pathNameDelimiter) ifFalse:
+ [^fName].
+ ^fixing
+ ifTrue: [fName copyReplaceAll: (String with: self class pathNameDelimiter) with: '#']
+ ifFalse: [self error:'Invalid file name']!
Item was changed:
----- Method: FileStream class>>detectFile:do: (in category 'instance creation') -----
detectFile: aBlock do: anotherBlock
+ ^aBlock value
+ ifNil: [nil]
+ ifNotNil: [:file| [anotherBlock value: file] ensure: [file close]]!
-
- | file |
-
- file := aBlock value.
- ^ file
- ifNil: [ nil ]
- ifNotNil: [ [anotherBlock value: file] ensure: [file close]]!
Item was changed:
----- Method: FileStream class>>writeSourceCodeFrom:baseName:isSt:useHtml: (in category 'file reader services') -----
writeSourceCodeFrom: aStream baseName: baseName isSt: stOrCsFlag useHtml: useHtml
| extension converter f fileName |
aStream contents isAsciiString ifTrue: [
stOrCsFlag ifTrue: [
extension := (FileDirectory dot, FileStream st).
] ifFalse: [
extension := (FileDirectory dot, FileStream cs).
].
converter := MacRomanTextConverter new.
] ifFalse: [
stOrCsFlag ifTrue: [
extension := (FileDirectory dot, FileStream st "multiSt").
] ifFalse: [
extension := (FileDirectory dot, FileStream cs "multiCs").
].
converter := UTF8TextConverter new.
].
fileName := useHtml ifTrue: [baseName, '.html'] ifFalse: [baseName, extension].
+ fileName := FileDirectory default checkName: fileName fixErrors: true.
f := FileStream newFileNamed: fileName.
f ifNil: [^ self error: 'Cannot open file'].
(converter isMemberOf: UTF8TextConverter)
ifTrue: [f binary.
UTF8TextConverter writeBOMOn: f].
f text.
f converter: converter.
f nextPutAll: aStream contents.
f close.
!
More information about the Squeak-dev
mailing list
|