24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
file mkdir [file dirname $file]
if {![file exists $file]} {
set tmpfile "${file}.new"
set fd [open $tmpfile "w"]
set token [::http::geturl $url -channel $fd]
set ncode [::http::ncode $token]
::http::reset $token
close $fd
if {$ncode == "200"} {
file rename -force -- $tmpfile $file
} else {
|
>
|
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
file mkdir [file dirname $file]
if {![file exists $file]} {
set tmpfile "${file}.new"
set fd [open $tmpfile "w"]
fconfigure $fd -translation binary
set token [::http::geturl $url -channel $fd -binary true]
set ncode [::http::ncode $token]
::http::reset $token
close $fd
if {$ncode == "200"} {
file rename -force -- $tmpfile $file
} else {
|