[squeak-dev] Re: Processing a file at image startup (scripting)

Andreas Raab andreas.raab at gmx.de
Tue May 26 18:00:55 UTC 2009


Cédrick Béler wrote:
> 2009/5/20 Andreas Raab <andreas.raab at gmx.de>:
>> 2) When your app starts, process command line args as you'd like, for
>> example:
>>
>> processCommandLine
>>    "Process command line arguments for this application"
> 
> Does this kind of method goes in a class that has to be added to the
> StartUpList ?

It depends on how you start your app. What we do for our images is that 
we use a class method called #runAsApp that is implemented on the main 
UI class. It looks roughly like here:

runAsApp
	"Run me as a standalone app, sealed without development information."
	WorldState addDeferredUIMessage:[
		World submorphs do:[:each| each delete].
		Preferences disable: #warnIfNoSourcesFile.
		Preferences disable: #warnIfNoChangesFile.
		(self confirm: 'Save the sealed image?') ifTrue:[
			AutoStart deinstall. "no autostart please"
			Smalltalk saveAs.
		].
		self launchAppFrame.
	].

#launchAppFrame then instantiates the actual UI which (indirectly) calls 
processCommandLine.

> Last, I'd like to know if there's a way to run headless without
> specifiing the parameter   -headless.  Actually, I'd like a vm that
> run headless by default. Do I need to build my own vm for that ? At
> the moment, I just created a small script so that all parameters are
> hidden inside.

That's what we do as well.

Cheers,
   - Andreas



More information about the Squeak-dev mailing list