[Pharo-project] Best way for embed a file on Smalltalk image method

nullPointer epicfan at gmail.com
Tue Oct 19 07:06:33 EDT 2010


Hi

I´m doing a class for embed files in class methods. I want know if exists a
best way for do that task than I´m using... I do something like that...


	   codeSource := CLStringBuilder new.
		codeSource appendLine: nameOfResource; tab;
					appendFormat: '^''{1}'' -> ''' withValues: {fileName}.
		
		readStream := FileStream readOnlyFileNamed: aFilePath.
		
		base64Contents := (Base64MimeConverter mimeEncode: readStream binary)
contents.
		
		codeSource append: base64Contents asString.
		codeSource append:''''.
	
		CLSystem createMessageInClass: self 
			withCodeSource: (codeSource asString) 
			inProtocol: 'resources'  
			inClassSide: true.


I get the next result:

courierNewBoldttf

	^'Courier New Bold.ttf' ->
'AAEAAAATAQAABAAwRFNJR0rTjTkACiUQAAAbgEdERUYTqQ1VAApAkAAAAkxHUE9T3wr9iAAK
QtwAADeeR1NVQgwWqYIACnp8AAAT1k9TLzIQrF1xAAABuAAAAGBWRE1YNVhPeQAAGrwAABGU
Y21hcHepKTsAACxQAAAhqmN2dCCka4hDAABqbAAACA5mcGdtUXaa9wAATfwAAAdZZ2FzcAAW
AAkACiUAAAAAEGdseWbVwXRoAACjvAAI9Z5oZWFk05ZxuQAAATwAAAA2aGhlYQrAAZoAAAF0
.......... '.


Exists a enhanced way for do that? My main problem is the image grow very
much. When I export to Monticello I get a file of 900 KB. When embed a file
of 600KB the final size on Monticello file is 2MB!! and almost 4MB of
difference in size of image  :(

Many thanks for the help



-- 
View this message in context: http://forum.world.st/Best-way-for-embed-a-file-on-Smalltalk-image-method-tp3001915p3001915.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.




More information about the Pharo-dev mailing list