[squeak-dev] Re: How to get a list of all plugins in VM
Andreas Raab
andreas.raab at gmx.de
Mon Mar 23 22:55:29 UTC 2009
Ross Boylan wrote:
> I'm trying to figure out if I'm setup so I can use some of the font
> packages. I'm running a 3.10 image (but 3.9 VM) on Linux (Debian
> Lenny).
>
> How do I get a list of all plugins?
You don't. External, unloaded plugins can't be enumerated since they are
just platform shared libraries (DLLs). They could be found anywhere in
your search path which makes it very difficult to list them explicitly.
The right way to solve your problem is to provide an entry point in your
plugin that can be used to detect whether the plugin is available. A
useful thing to do here is to provide a primitiveVersion because later
on you'll be able to use that to detect whether the user has an outdated
plugin version. Then you can simply implement something like:
MyClass>>pluginVersion
"Returns the plugin version, or nil if the plugin cannot be loaded"
<primitive: 'primitiveVersion' module: 'MyPlugin'>
^nil "indicates failure"
MyClass>>isPluginPresent
"Returns true if the plugin is present"
^self pluginVersion notNil
MyClass>>isPluginOfTheRightVersion
"Returns true if the plugin is of the right version"
^(self pluginVersion ifNil:[0]) > self minimumVersion
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|