It seems ::freewrap::unpack no longer supported
Brought to you by:
freewrapmgr
I used the following code to extract executable for the freewrapped app
set plink [::freewrap::unpack /zvfs/$name/plink.exe]
set pscp [::freewrap::unpack /zvfs/$name/pscp.exe]
However now the code does not work under 7.0.1 - invalid command name ::freewrap::unpack
It seems the unpack was removed... Is that a bug or a design decision?
Is there a better way to use wrapped executables?
Anonymous
The freewrap::unpack procedure was intentionally removed as of freeWrap version 7,0. I decided that the procedure's functionality should be the responsibility of the developer's application. Especially in terms of any necessary error trapping.
Here is the source code from versions prior to 7 .0.
proc unpack {path {destdir {}}} {
;# Unpack a file from ZVFS into a native location.
;#
;# path = ZVFS path of file to unpack
;# destdir = optional destination directory for unpacked file.
;#
;# Returns: on success, the name of the native file
;# on failure, an empty string
;#
global env
global tcl_platform
variable errormsg
set filename {}
if {[file exists $path]} {
if {$destdir == {}} {
if {$tcl_platform(platform) == "windows"} {
set destdir [file attributes $env(TEMP) -longname]
} { set destdir /usr/tmp }
}
if {![file isdirectory $destdir]} { return {}}
set dest [file join $destdir [file tail $path]]
if {[file exists $dest]} {
# The file has already been copied once.
set filename $dest
} {
# copy the file to its temporary location
set fin [open $path r]
if {[catch {open $dest w} fout]} {
set errormsg $fout
close $fin
} {
fconfigure $fin -translation binary -buffersize 500000 -encoding binary
fconfigure $fout -translation binary -buffersize 500000 -encoding binary
set ext [file extension $path]
puts -nonewline $fout [read $fin]
close $fin
close $fout
set filename $dest
catch {file mtime $dest [file mtime $path]}
}
}
}
return $filename
}