aboutsummaryrefslogtreecommitdiff
path: root/initjimsh.tcl
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2011-07-12 09:02:32 +1000
committerSteve Bennett <steveb@workware.net.au>2011-07-13 11:30:29 +1000
commite7e3cedcbde855a2f22ee9eb830b62c45b543836 (patch)
tree82d43014a41de21a813a0f7df3accd5ef26b6721 /initjimsh.tcl
parent539f52a07c94d769e51d046d71903e4a2505edd7 (diff)
downloadjimtcl-e7e3cedcbde855a2f22ee9eb830b62c45b543836.zip
jimtcl-e7e3cedcbde855a2f22ee9eb830b62c45b543836.tar.gz
jimtcl-e7e3cedcbde855a2f22ee9eb830b62c45b543836.tar.bz2
Add tcl_platform(pathSeparator)
Tcl compatible. Also move jimsh initialisation script into initjimsh.tcl Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'initjimsh.tcl')
-rw-r--r--initjimsh.tcl27
1 files changed, 27 insertions, 0 deletions
diff --git a/initjimsh.tcl b/initjimsh.tcl
new file mode 100644
index 0000000..a764f3a
--- /dev/null
+++ b/initjimsh.tcl
@@ -0,0 +1,27 @@
+# This pseudo-package is loaded from jimsh to add additional
+# paths to $auto_path and to source ~/.jimrc
+
+proc _jimsh_init {} {
+ rename _jimsh_init {}
+
+ # Add to the standard auto_path
+ lappend p {*}[split [env JIMLIB {}] $::tcl_platform(pathSeparator)]
+ lappend p {*}$::auto_path
+ lappend p [file dirname [info nameofexecutable]]
+ set ::auto_path $p
+
+ if {$::tcl_interactive && [env HOME {}] ne ""} {
+ foreach src {.jimrc jimrc.tcl} {
+ if {[file exists [env HOME]/$src]} {
+ uplevel #0 source [env HOME]/$src
+ break
+ }
+ }
+ }
+}
+
+if {$tcl_platform(platform) eq "windows"} {
+ set jim_argv0 [string map {\\ /} $jim_argv0]
+}
+
+_jimsh_init