diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2011-11-10 23:57:24 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2011-11-10 23:57:24 +0000 |
commit | 3204da1250f36047ad32fab52167d30ff812bb46 (patch) | |
tree | 19220e81c54531f7a178efd42056982255eb98b2 /exists.tcl | |
parent | 70a037898aa44a933c0e5c199b7ac97a392eb0f9 (diff) |
full working implementation using canvas_getdir, and some help on tclpd style from mescalinum
svn path=/trunk/externals/tclfile/; revision=15720
Diffstat (limited to 'exists.tcl')
-rw-r--r-- | exists.tcl | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -2,6 +2,10 @@ package require Tclpd 0.2.3 package require TclpdLib 0.19 proc+ exists::constructor {self args} { + set @current_canvas [canvas_getcurrent] + # set to blank so the var always exists + set @filename {} + # add second inlet (first created by default) pd::add_inlet $self list @@ -16,8 +20,12 @@ proc+ exists::0_symbol {self args} { } proc+ exists::0_bang {self} { - if {![info exists @filename]} return - pd::outlet $self 0 float [file exists $@filename] + if {[file pathtype $@filename] eq "absolute"} { + pd::outlet $self 0 float [file exists $@filename] + } else { + set dir [[canvas_getdir $@current_canvas] cget -s_name] + pd::outlet $self 0 float [file exists [file join $dir $@filename]] + } } proc+ exists::1_symbol {self args} { |