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

Cédrick Béler cdrick65 at gmail.com
Tue May 26 12:17:59 UTC 2009


Thanks for your answers :)

2009/5/20 Andreas Raab <andreas.raab at gmx.de>:
> If you are shipping a "real" application (i.e., not some image that people
> do further development in) it is probably advantageous to do the command
> line handling yourself.

Yes, this si sort of what I did.

> This is extremely simple:
>
> 1) Execute "AutoStart deinstall" when you prepare your app to get AutoStart
> and ProjectLauncher out of the way.

ok, cool thanks. I hadn't noticed that.

>
> 2) When your app starts, process command line args as you'd like, for
> example:
>
> processCommandLine
>    "Process command line arguments for this application"
>    | index attr arg forumToLoad robot |
>    self isSealedApplication ifFalse:[^nil]. "only process command line for
> sealed apps"
>    index := 0.
>    [attr := Smalltalk getSystemAttribute: (index := index + 1).
>    attr isNil] whileFalse:[
>      attr caseOf:{
>         ['-enableDebug']  -> [
>             self enableDebug: true.
>         ].
>         ['-debugLevel:']  -> [
>             arg := (Smalltalk getSystemAttribute: (index := index + 1))
> asNumber.
>             self debugLevel: arg.
>         ].
>      } otherwise:[
>         "Check if this is just a file that was associated with the app"
>         (self isKnownFileType: attr)
>            ifTrue:[self launchWithFile: attr].
>      ].
>    ].

Does this kind of method goes in a class that has to be added to the
StartUpList ?

MyFinalizationClass>>startUp

     self processCommandLine



Another question I have in mind is if it's possible to have a minimum
classes at startUp (if useful). Right now, in the StartUpList var, I
have for StartUpList:

#(#Delay #DisplayScreen #Cursor #InputSensor #ProcessorScheduler
#LanguageEnvironment #FileDirectory #ShortIntegerArray #ShortRunArray
#CrLfFileStream
#PasteUpMorph #NaturalLanguageTranslator #ImageSegment #ThisOSProcess
#PowerManagement #ExternalSettings #SecurityManager
#FreeTypeFontProvider #AutoStart
#SspApplication #UUIDGenerator #ProcessBrowser #CPUWatcher
#DateAndTime #SmalltalkImage #HostSystemMenus #Utilities #MenuIcons
#WeakArray #MultiByteFileStream #InternetConfiguration #Locale
#CommandHistory #HostWindowProxy #FreeTypeSettings #UITheme
#WAServerManager #WAExternalID #SpEnvironment #ApplicationService
#ModDoc #SDCheckPointer nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil)

Is there somewhere a "minimal" list of needed classes to run an image
headless ? Maybe this is not important anyway but I'd like to have a
"minimum system" to be shipped.


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.

Thanks,

Cédrick



More information about the Squeak-dev mailing list