Re: Moving file out of starkit.
Pat Thoyts <[email protected]> Mon, 13 Apr 2009 10:42:24 +0100
| Newsgroups | gmane.comp.lang.tcl.starkit |
|---|---|
| Message-ID | <[email protected]> |
2009/4/11 John Culleton <[email protected]>: > > In the same tyro.tcl app mentioned earlier I want to move a > file out of the vfs and make it visible to other programs. > I assume I can use a call in my tcl program like > exec cp workfile ../../../ > but if there is a better way I would appreciate some advice. > > Further, I assume the MSWin version would be > exec cp workfile ..\..\..\ > > I can't test this code yet because of the difficulty I > mentioned earlier today. file copy Here is one I use for copying a certificate file (openssl won't read it from the vfs either) proc copy_ca_file {} { global env set path [file join $::tkchat_dir certs.pem] if {![file exists $path]} { return {} } if {[lindex [file system $path] 0] ne "native"} { set new {} foreach var {TEMP TMP TMPDIR} { if {[info exists env($var)] \ && [file isdirectory $env($var)] \ && [file writable $env($var)]} then { set new [file join $env($var) tkchat.pem] break } } if {$new eq {}} { if {[file isdirectory /tmp] && [file writable /tmp]} { set new [file join /tmp tkchat.pem] } else { log::log error "cannot find a tempfile location" return {} } } log::log info "copying certificate collection to $new" file copy -force $path $new return $new } return $path } Pat Thoyts