From d8fb263c68f6fb1b0c6af283dd78c88a2a813336 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Fri, 24 Sep 2004 12:51:11 +0000 Subject: The demos path is managed locally by the demosPath proc --- demos/zinc-widget | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'demos') diff --git a/demos/zinc-widget b/demos/zinc-widget index 1ff1f05..9132771 100644 --- a/demos/zinc-widget +++ b/demos/zinc-widget @@ -201,6 +201,21 @@ proc showVars {w args} { pack $w.ok -side bottom -pady 2 } +# +# demosPath -- +# Return the path to the installed demo directory. + +proc demosPath {} { + global zinc_library tcl_platform + + if { [lindex $tcl_platform(os) 0] eq "Windows" && + ! [file exists [file join $zinc_library pkgIndex.tcl]] } { + return [file join $zinc_library demos Tkzinc] + } { + return [file join $zinc_library demos] + } +} + # invoke -- # This procedure is called when the user clicks on a demo description. # It is responsible for invoking the demonstration. @@ -209,8 +224,6 @@ proc showVars {w args} { # index - The index of the character that the user clicked on. proc invoke index { - global zinc_library - set tags [.t tag names $index] set i [lsearch -glob $tags demo-*] if {$i < 0} { @@ -220,7 +233,7 @@ proc invoke index { .t configure -cursor watch update set demo [string range [lindex $tags $i] 5 end] - uplevel [list source [file join $zinc_library demos $demo.tcl]] + uplevel [list source [file join [demosPath] $demo.tcl]] update .t configure -cursor $cursor -- cgit v1.1