From 14ec58b563dec017fa4e7c7b901d674aea41a454 Mon Sep 17 00:00:00 2001 From: Nick White Date: Wed, 5 Sep 2012 19:34:04 +0100 Subject: Improve style of tcl, and ensure file operations are platform independent --- getxbookgui.tcl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/getxbookgui.tcl b/getxbookgui.tcl index 0c5c116..eb3c863 100755 --- a/getxbookgui.tcl +++ b/getxbookgui.tcl @@ -13,7 +13,7 @@ set dling 0 set manual 0 set env(PATH) "[file dirname $::argv0]:$env(PATH)" -set iconpath "[file dirname $::argv0]/icons" +set iconpath [file join [file dirname $::argv0] icons] proc updateStatus {chan} { global dling @@ -26,7 +26,9 @@ proc updateStatus {chan} { if { [regexp {^([0-9]*)} $a m num] && "$num" != "" } { .prog coords bar 0 0 [expr $num * 2] 20 } - } else { .st configure -text $a } + } else { + .st configure -text $a + } } } else { if { ! [catch {close $chan}] } { @@ -41,7 +43,9 @@ proc updateStatus {chan} { proc go {} { global dling cmdselected cmds - if { [.input.id get] == "" } { return } + if { [.input.id get] == "" } { + return + } set cmd "[lindex [lindex $cmds $cmdselected] 0] [.input.id get]" set dling 1 .dl configure -state disabled -text "Downloading" @@ -107,7 +111,7 @@ frame .cmdfr set i 0 foreach b $cmds { set cmdname [lindex $b 0] - if { [catch {image create photo im$i -file "$iconpath/$cmdname.gif"}] } { + if { [catch {image create photo im$i -file [file join $iconpath $cmdname.gif]}] } { image create photo im$i } button .cmdfr.$i -text [lindex $b 2] -image im$i \ @@ -133,5 +137,6 @@ bind . go bind .input.id {set manual 1; checkinput} bind .input.id