[REBOL] How can I do what Launch does?
From: sanghabum:aol at: 15-Apr-2001 7:28
In another thread, Carl S. writes:
> Launch has a rule: you can only launch from the main REBOL process.
> This prevents launch loops.
That touches precisely on something I was trying to figger out the other day.
I've got a set of scripts (a.r, b.r, c.r). a.r uses DO to call b.r and c.r.
But it doesn't make sense for my intended user to in any way execute b.r or
c.r directly.
So, if they do, I want to tell them not to, something like:
if not (top-level) [throw "Please run a.r to start the application"].
But I haven't found the best way of writing top-level.....
-- I could use value? on a global variable. But global variables are
generally a Bad Thing in my book, so I'd like to avoid them.
-- I could scrabble round the System object for something that shows I'm top
level or not. But a quick look, didn't find me anything.
-- I could avoid the problem by giving b.r and c.r a different suffix (b.rll
and c.rll?). But who knows what effect that'll have when the user
double-clicks them?
So, whatever check Launch is making, I'd like to be able to make something
similar.
Any ideas how?
Thanks,
Colin.