net/ftp: put temp file for download in directory of destination

This commit is contained in:
Matthew Flatt 2013-02-14 13:01:51 -07:00
parent 294bed209e
commit f1b4c86519
2 changed files with 3 additions and 3 deletions

View File

@ -202,8 +202,8 @@
;; Save the file under the name tmp.file, rename it once download is
;; complete this assures we don't over write any existing file without
;; having a good file down
(let* ([tmpfile "file.tmp"]
[new-file (open-output-file tmpfile #:exists 'replace)]
(let* ([tmpfile (make-temporary-file "~a.download" #f folder)]
[new-file (open-output-file tmpfile #:exists 'truncate)]
[tcp-data (establish-data-connection ftp-ports 'in)])
(transfer-data ftp-ports 'download tcp-data new-file filename progress-proc)

View File

@ -91,7 +91,7 @@ Downloads @racket[file] from the server's current directory and puts
it in @racket[local-dir] using the same name. If the file already
exists in the local directory, it is replaced, but only after the
transfer succeeds (i.e., the file is first downloaded to a temporary
file, then moved into place on success).
file in @racket[local-dir], then moved into place on success).
If @racket[progress-proc] is not @racket[#f], then it is called with a
function @racket[_get-count] that returns two values: the number of bytes