[Orxonox-commit 838] r2211 - media/tcl
landauf at orxonox.net
landauf at orxonox.net
Sun Jul 26 01:04:34 CEST 2009
Author: landauf
Date: 2009-07-26 01:04:34 +0200 (Sun, 26 Jul 2009)
New Revision: 2211
Modified:
media/tcl/init.tcl
Log:
fixed a problem with orxonox' wrapper of the unknown proc
added some path utilities: [pwd], [psd] and [pld] for working, start and library directory respectively ($pwd, $psd and $pld are the corresponding variables)
Modified: media/tcl/init.tcl
===================================================================
--- media/tcl/init.tcl 2009-07-25 19:47:30 UTC (rev 2210)
+++ media/tcl/init.tcl 2009-07-25 23:04:34 UTC (rev 2211)
@@ -92,13 +92,36 @@
# add the path to this file to the auto path
set filepath [info script]
-set ::orxonox::mediapath [string range $filepath 0 [string last "/" $filepath]]
+#set ::orxonox::mediapath [string range $filepath 0 [string last "/" $filepath]]
+set ::orxonox::mediapath [file dirname $filepath]
if {[lsearch $auto_path $::orxonox::mediapath] == -1} {
lappend auto_path $::orxonox::mediapath
}
unset filepath
+# save the start directory and the library directory
+
+proc psd {} "return [pwd]"
+proc pld {} "return $::orxonox::mediapath"
+
+set pwd [pwd]
+set psd [psd]
+set pld [pld]
+
+
+# modify cd to automatically set $pwd
+
+if {[llength [info command ::tcl::cd]] == 0} {
+ rename cd ::tcl::cd
+}
+proc cd {{path "~"}} {
+ global pwd
+ ::tcl::cd $path
+ set pwd [pwd]
+}
+
+
# change the working directory to the media path
cd $::orxonox::mediapath
@@ -186,11 +209,11 @@
proc unknown args {
global ::orxonox::errormessage_unknown ::orxonox::errormessage_unknown_length
-tcl::puts "unknown: $args"
- set errorcode [catch {::tcl::unknown $args} result options]
+ set cmd [concat ::tcl::unknown $args]
+ set errorcode [catch {eval $cmd} result options]
set resultlist [split $result]
set success 1
-tcl::puts "errorcode: $errorcode resultlist: $resultlist"
+
if {$errorcode && [llength $resultlist] >= $::orxonox::errormessage_unknown_length} {
for {set i 0} {$i < $::orxonox::errormessage_unknown_length} {incr i} {
if {[lindex $::orxonox::errormessage_unknown $i] != [lindex $resultlist $i]} {
@@ -198,8 +221,10 @@
break
}
}
+ } else {
+ set success 0
}
-tcl::puts "success: $success"
+
if {!$success} {
return -code $errorcode -options $options $result
} else {
More information about the Orxonox-commit
mailing list