How to to ell if a stack is loaded as a plugin
andre at andregarzia.com
Thu Jun 2 15:52:34 CDT 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.
> >> 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
> 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
> -- 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://www.andregarzia.com All We Do Is Code.
More information about the use-livecode