[Pkg] Rio: File-Base-mtf.30.mcz

squeak-dev-noreply at lists.squeakfoundation.org squeak-dev-noreply at lists.squeakfoundation.org
Wed Jul 1 18:10:11 UTC 2009


A new version of File-Base was added to project Rio:
http://www.squeaksource.com/Rio/File-Base-mtf.30.mcz

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

Name: File-Base-mtf.30
Author: mtf
Time: 1 July 2009, 2:10:07 pm
UUID: 68b3e656-666a-11de-b5fb-001124e29fe6
Ancestors: File-Base-jrd.29

modified the base, version, and extension changing methods to preserve the padding in the version number

Added convenience methods to File and Directory for accessing the image, changes, and sources files, and the image directory

Created a filename-safe format for timestamps and modified temp file creation to use that (the previous format used tildes and colens, which don't work on all platforms)

=============== Diff against File-Base-jrd.29 ===============

Item was changed:
  ----- Method: File class>>tmp (in category 'as yet unclassified') -----
  tmp
  
+ 	^ (Directory tmp / (SystemVersion current majorMinorVersion asString , '-', DateAndTime now forFileName)) asFile!
- 	^ (Directory tmp / (SystemVersion current majorMinorVersion asString , '~', DateAndTime now asString)) asFile!

Item was added:
+ ----- Method: DateAndTime>>forFileName (in category '*file-base') -----
+ forFileName
+ "Answers a string representing this date that is safe for use in a filename. YYYY-MM-DDThh.mm.ss.nnnnnnnnn"
+ 
+ 	^ String streamContents: [:stream | self printForFileNameOn: stream]!

Item was added:
+ ----- Method: File class>>sourcesFile (in category 'as yet unclassified') -----
+ sourcesFile
+ "Answer the file representing the active .sources file, or nil if none"
+ 
+ 	^ self new: (SourceFiles at: 1 ifAbsent: [^ nil]) name!

Item was changed:
  ----- Method: File>>version: (in category 'accessing fileName') -----
+ version: aStringOrIntegerOrNil
+ "Set the version portion of my filename to aString, or remove it if nil. If an integer is passed in, it will be padded the same as the old version number was"
+ 
+ 	| version |
+ 	self splitToBaseVersionStringAndExt: [:b :v :e |
+ 		version := aStringOrIntegerOrNil.
+ 		version isInteger ifTrue: [
+ 			version := version asString padded: #left to: v size with: $0].
+ 		self basicBase: b version: version ext: e]!
- version: newVersion 
- 	
- 	self base: nil version: newVersion ext: nil
- !

Item was changed:
  ----- Method: File>>base: (in category 'accessing fileName') -----
+ base: aString
+ "Set the base portion of my filename to aString" 
- base: newName 
  	
+ 	self splitToBaseVersionStringAndExt: [:b :v :e |
+ 		self basicBase: aString version: v ext: e]
- 	self base: newName version: nil ext: nil
  !

Item was added:
+ ----- Method: File class>>imageFile (in category 'as yet unclassified') -----
+ imageFile
+ "Answer the file representing this image"
+ 
+ 	^ self thisImage!

Item was added:
+ ----- Method: File class>>changesFile (in category 'as yet unclassified') -----
+ changesFile
+ "Answer the file representing the active .changes file, or nil if none"
+ 
+ 	^ self new: (SourceFiles at: 2 ifAbsent: [^ nil]) name!

Item was added:
+ ----- Method: DateAndTime>>printForFileNameOn: (in category '*file-base') -----
+ printForFileNameOn: aStream
+ 	"A date format safe for use in a filename. YYYY-MM-DDThh.mm.ss.nnnnnnnnn"
+ 	self printYMDOn: aStream.
+ 	aStream
+ 		nextPut: $T;
+ 		nextPutAll: (self hour asString padded: #left to: 2 with: $0);
+ 		nextPut: $.;
+ 		nextPutAll: (self minute asString padded: #left to: 2 with: $0);
+ 		nextPut: $.;
+ 		nextPutAll: (self second asString padded: #left to: 2 with: $0);
+ 		nextPut: $.;
+ 		nextPutAll: (self nanoSecond asString padded: #left to: 9 with: $0)!

Item was added:
+ ----- Method: Directory class>>imageDir (in category 'as yet unclassified') -----
+ imageDir
+ "The directory holding this image"
+ 
+ 	^ File imageFile parent!

Item was changed:
  ----- Method: File>>ext: (in category 'accessing fileName') -----
+ ext: aStringOrNil
+ "Set the extension portion of my filename to aString, or remove it if nil"
+ 
+ 	self splitToBaseVersionStringAndExt: [:b :v :e |
+ 		self basicBase: b version: v ext: aStringOrNil
+ !
- ext: newExt 
- 	
- 	self base: nil version: nil ext: newExt!



More information about the Packages mailing list