For Programmers: Free Programming Magazines  


Home > Archive > Tcl > March 2008 > Tclkit introspection options









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Tclkit introspection options
Aric Bills

2008-03-26, 7:59 pm

Hello all,

I'm wondering what my options are for discovering whether the current
script is operating from within a Tclkit, and if so, in what directory
the Tclkit resides. The reason I ask is that I'd like to create a
file in the directory where my program lives. If my program is just a
Tcl script, I can use [info script] to discover the directory; but if
my program is a Tclkit, [info script] will give me a virtual directory
which (as far as I know) I can't write to, and I don't think I want to
do that in any case.

Thanks in advance for any suggestions.

Regards,
Aric
Gerald W. Lester

2008-03-26, 7:59 pm

Aric Bills wrote:
> Hello all,
>
> I'm wondering what my options are for discovering whether the current
> script is operating from within a Tclkit, and if so, in what directory
> the Tclkit resides. The reason I ask is that I'd like to create a
> file in the directory where my program lives. If my program is just a
> Tcl script, I can use [info script] to discover the directory; but if
> my program is a Tclkit, [info script] will give me a virtual directory
> which (as far as I know) I can't write to, and I don't think I want to
> do that in any case.
>
> Thanks in advance for any suggestions.


As usual, the Tcler's Wiki comes to the rescue at: http://wiki.tcl.tk/8186

--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
Aric Bills

2008-03-27, 5:26 am

> As usual, the Tcler's Wiki comes to the rescue at:http://wiki.tcl.tk/8186

It took me a couple reads to discover it, but the answer is indeed
there (for those who may stumble across this post in the future,
[starkit::startup] gives information about whether a script was
sourced as a starkit, etc. and $starkit::topdir contains information
about the directory structure. Both come from the starkit package).

Thanks, Gerald.

Aric
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com