The Trunk: Files-ct.222.mcz
[email protected] Wed, 10 Jun 2026 13:32:07 0000
| Newsgroups | gmane.comp.lang.smalltalk.squeak.general |
|---|---|
| Message-ID | <[email protected]> |
Christoph Thiede uploaded a new version of Files to project The Trunk: http://source.squeak.org/trunk/Files-ct.222.mcz ==================== Summary ==================== Name: Files-ct.222 Author: ct Time: 10 June 2026, 3:17:51.913184 pm UUID: 14a5a885-7b10-480f-8d70-4dec314d7756 Ancestors: Files-mt.221 Fixes file-outs of methods or message categories whose name contains a slash, such as Collection>>// or "fileIn/Out". Also fixes version number counting for change sets whoe name contains a slash (e.g., a change set named '/' was always exported as #.1.cs before). Thanks to Robert (rhi) for the bug report! =============== Diff against Files-mt.221 =============== Item was changed: ----- Method: FileDirectory>>lastNameFor:extension: (in category 'file name utilities') ----- lastNameFor: baseFileName extension: extension "Assumes a file name includes a version number encoded as '.' followed by digits preceding the file extension. Increment the version number and answer the new file name. If a version number is not found, set the version to 1 and answer a new file name" + | base files splits | + base := baseFileName asFileName. + files := self fileNamesMatching: (base, '*', self class dot, extension). - | files splits | - - files := self fileNamesMatching: (baseFileName,'*', self class dot, extension). splits := files collect: [:file | self splitNameVersionExtensionFor: file] + thenSelect: [:split | (split at: 1) = base]. - thenSelect: [:split | (split at: 1) = baseFileName]. splits isEmpty ifTrue: [ ^nil ]. + ^(base, '.', ((splits detectMax: [ :each | each at: 2]) at: 2) asString, self class dot, extension) asFileName! - ^(baseFileName, '.', ((splits detectMax: [ :each | each at: 2]) at: 2) asString, self class dot, extension) asFileName! Item was changed: ----- Method: FileDirectory>>nextNameFor:extension: (in category 'file name utilities') ----- nextNameFor: baseFileName extension: extension "Assumes a file name includes a version number encoded as '.' followed by digits preceding the file extension. Increment the version number and answer the new file name. If a version number is not found, set the version to 1 and answer a new file name" + | base files splits version | + base := baseFileName asFileName. + files := self fileNamesMatching: (base, '*', self class dot, extension). - | files splits version | - - files := self fileNamesMatching: (baseFileName,'*', self class dot, extension). splits := files collect: [:file | self splitNameVersionExtensionFor: file] thenSelect: [:split | self isCaseSensitive + ifTrue:[(split at: 1) = base] + ifFalse:[(split at: 1) match: base]]. - ifTrue:[(split at: 1) = baseFileName] - ifFalse:[(split at: 1) match: baseFileName]]. version := splits isEmpty ifTrue: [1] ifFalse: [((splits detectMax: [ :each | each at: 2 ]) at: 2) + 1]. + ^ (base, '.', version asString, self class dot, extension) asFileName! - ^ (baseFileName, '.', version asString, self class dot, extension) asFileName! Item was changed: ----- Method: FileDirectory>>writeSourceCodeFrom:baseName:isSt:useHtml: (in category 'utilities') ----- writeSourceCodeFrom: sourceStream baseName: baseName isSt: stOrCsFlag useHtml: useHtml "Write the source code from sourceStream into a file. The stream's content format is indicated via stOrCsFlag and useHtml. We must ensure that a text converter for code is used to not differ from the system's current text converter. See #Locale." | extension | extension := FileDirectory dot, (useHtml ifTrue: ['html'] ifFalse: [stOrCsFlag ifTrue: [FileStream st] ifFalse: [FileStream cs]]). self + newFileNamed: (baseName, extension) asFileName - newFileNamed: baseName, extension do: [:targetStream | targetStream nextPutUTF8BOM; "Backwards compatibililty." setConverterForCode; nextPutAll: sourceStream contents]! Squeak-dev mailing list -- [email protected] To unsubscribe send an email to [email protected]