The Trunk: Files-ar.83.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Files-ar.83.mcz

commits-2
Andreas Raab uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-ar.83.mcz

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

Name: Files-ar.83
Author: ar
Time: 9 August 2010, 10:11:57.746 pm
UUID: 7afec443-3da1-f84d-ab62-83fe3199c455
Ancestors: Files-eem.82

Move writeSourceCodeFrom:... from FileStream to FileDirectory and have FileStream vector the request through ChangeSet defaultChangeSetDirectory for consistency between all file-out operations.

=============== Diff against Files-eem.82 ===============

Item was added:
+ ----- Method: FileDirectory>>writeSourceCodeFrom:baseName:isSt:useHtml: (in category 'utilities') -----
+ writeSourceCodeFrom: aStream baseName: baseName isSt: stOrCsFlag useHtml: useHtml
+ "Write the source code from aStream into a file."
+
+ | 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 := self checkName: fileName fixErrors: true.
+ f := self 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.
+ !

Item was changed:
  ----- Method: FileStream class>>writeSourceCodeFrom:baseName:isSt:useHtml: (in category 'file reader services') -----
  writeSourceCodeFrom: aStream baseName: baseName isSt: stOrCsFlag useHtml: useHtml
+ "Write the source code from aStream into a file.
+ Uses ChangeSet defaultChangeSetDirectory for consistency."
 
+ ^(ChangeSet defaultChangeSetDirectory)
+ 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.
- !