Version 3 of Accessing the help pages without changing the default directory

Updated 2011-02-09 16:57:55 by GJS

Didier (2011-02-09] I wonder if I can work around this difficulty. I thought I coded a very clever piece of code. In my program, if I click on a file in Directory A, A becomes a default directory. Now the problem started when I had to code the Help. If I call the Help page, the directory will be changed to the Help directory. Which is what I don't want. What I'd like is to stay in the current directory and to view the Help pages which are in another directory without changing the default directory. Is this possible?

GJS (2011-02-09) You need to use the full path of the help files. Sometimes it helps to store important directories in some sort of variable when your application starts up. One method of getting the directory your script is running from would be to use [file dirname [info script]]]. If you are developing a starkit you may choose to use $::starkit::topdir to get the directory that main.tcl is in. To get the directory the starkit is in you can use [file dirname $::starkit::topdir]. Once you have saved the main directory of the app, lets say you used a variable name dir, you can use [file join $dir help] to get the a directory named help, or [file join $dir help myhelp.txt] to get the help file. Hopefully this answers your question.