- Timestamp:
- Mar 31, 2012, 10:00:28 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/filexfer.tcl
r2745 r2899 51 51 } 52 52 if {[file executable $path]} { 53 # the new filexfer has a --provenance arg for file names 54 set info [exec $path --help 2>@1] 55 if {[regexp -- {--provenance} $info]} { 56 lappend path --provenance 57 } 53 58 set commands($op) $path 54 59 } else { … … 132 137 # information. If anything goes wrong, the same callback is used 133 138 # to post errors near the widget that invoked this operation. 139 # 140 # The <id> is usually a Rappture path for the control that is being 141 # uploaded into. It is passed along to the <callback>, so that code 142 # knows where to put the result. If <id> is "@@<dir>", then the file 143 # is uploaded into the specified directory <dir> using the name that 144 # comes from the remote upload. 134 145 # ---------------------------------------------------------------------- 135 146 proc Rappture::filexfer::upload {tool controlList callback} { … … 173 184 set changed "" 174 185 set errs "" 175 foreach file $job(output) { 186 foreach line [split $job(output) \n] { 187 # the new filexfer reports "file <= desktopName" 188 # the old one just reports "file" 189 set remote "" 190 if {![regexp {(.+) +<= +(.+)} $line match file remote]} { 191 set file [string trim $line] 192 } 193 176 194 # load the uploaded for this control 177 195 set status [catch { … … 180 198 set info [read $fid] 181 199 close $fid 182 file delete -force $file 200 if {[string match @@* $file2path($file)]} { 201 if {$remote ne "" && $remote ne "@CLIPBOARD"} { 202 set dir [string range $file2path($file) 2 end] 203 if {$dir eq ""} { set dir [pwd] } 204 set newloc [file join $dir $remote] 205 file rename -force -- $file $newloc 206 } 207 } else { 208 file delete -force $file 209 } 183 210 } result] 184 211 … … 187 214 } else { 188 215 lappend changed $file2path($file) 189 uplevel #0 [list $callback path $file2path($file) data $info] 216 set cmd [list $callback path $file2path($file) local $file data $info] 217 if {$remote ne ""} { 218 lappend cmd remote $remote 219 } 220 uplevel #0 $cmd 190 221 } 191 222 } … … 226 257 uplevel #0 [list $callback error "Error loading file [file tail $file]: $err"] 227 258 } else { 228 uplevel #0 [list $callback path $path data $info ]259 uplevel #0 [list $callback path $path data $info filename $file] 229 260 } 230 261 }
Note: See TracChangeset
for help on using the changeset viewer.