#lang scheme/base (require (only-in (planet synx/util:1/pipe-between) pipe-between) (only-in (planet synx/util:1/gui-system) copy-file) (prefix-in temp: (planet synx/util:1/temp))) (define (incremental dump base name) (define base-file (build-path base name)) (if (not (file-exists? base-file)) (begin (dump base-file) (copy-file base-file name)) (temp:with-file (λ (holder) (define delta (string-append name ".xdelta")) (dump holder) (pipe-between ("xdelta" "delta" (path->string base-file) (path->string holder) delta)) (when (> (file-size delta) (file-size base-file)) (delete-file delta) (dump base-file) (copy-file base-file name)))))) (provide incremental)