From 3287b8661dcd300c6c662f173528cca423e19ce4 Mon Sep 17 00:00:00 2001 From: oharboe Date: Wed, 16 Jul 2008 20:20:15 +0000 Subject: Fixes to \ and / handling for OpenOCD git-svn-id: svn://svn.berlios.de/openocd/trunk@815 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/startup.tcl | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/startup.tcl') diff --git a/src/startup.tcl b/src/startup.tcl index 5fe7c8fe..abdf58ff 100644 --- a/src/startup.tcl +++ b/src/startup.tcl @@ -134,6 +134,29 @@ proc target_script {target_num eventname scriptname} { } -#add_help_text target_script "xxx" +# Try flipping / and \ to find file if the filename does not +# match the precise spelling +proc find {filename} { + if {[catch {openocd_find $filename} t]==0} { + return $t + } + if {[catch {openocd_find [string map {\ /} $filename} t]==0} { + return $t + } + if {[catch {openocd_find [string map {/ \\} $filename} t]==0} { + return $t + } + # make sure error message matches original input string + return [openocd_find $filename] +} +add_help_text find " - print full path to file according to OpenOCD search rules" + +# Run script +proc script {filename} { + source [find $filename] +} + +add_help_text script " - filename of OpenOCD script (tcl) to run" + add_help_text target_script " " -- cgit v1.2.3