How to to ell if a stack is loaded as a plugin

Andre Garzia andre at andregarzia.com
Thu Jun 2 16:52:34 EDT 2011


On Thu, Jun 2, 2011 at 5:29 PM, Ken Ray <kray at sonsothunder.com> wrote:

>
> >> In fact I think any test based on the directory wouldn't be so good.
>  There
> >> would always be the chance that you opened through the file browser.
> >
> > A plugin is just a stack that can be conveniently opened by placing it
> > in the Plugins folder.
> >
> > If you take it out of the folder, that distinction is lost.
>
> So that means that your directory-based test is the way to go, something
> like:
>
> put revEnvironmentPluginsPath() into tPlugPath1
> put revEnvironmentUserPlugsinPath() into tPlugPath2
> put the fileName of the mainstack of <stackRef> into tFileName
> if (char 1 to length(tPlugPath1) of tFileName = tPlugPath1) or \
>  (char 1 to length(tPlugPath2) of tFileName = tPlugPath2) then
>  -- it's a plugin
> else
>  -- it isn't
> end if
>
>
I use something like that here and works great! The only way for this to
fail is if a plugin loads another stack from elsewhere as a palette and this
stack is outside both folders, such as a remote stack, but except for that
it works great



> Hope this helps,
>
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
http://www.andregarzia.com All We Do Is Code.



More information about the use-livecode mailing list