fix recover script

svn: r2953
This commit is contained in:
Matthew Flatt 2006-05-16 16:02:41 +00:00
parent 5c392a8d72
commit 523d7db8bc
2 changed files with 9 additions and 3 deletions

View File

@ -126,3 +126,8 @@ entry is a list of at least two elements:
The overriding-options feature was a quick hack for what I needed, and
it should be replaced eventually. There's a lot of duplication of
information in the current format.
For an individual folder, if your "mailbox" file gets corrupted, you
can run the "recover.ss" script with the mail folder's directory as
the current directory.

View File

@ -3,8 +3,9 @@
(lib "head.ss" "net"))
(define msgs
(sort (filter (lambda (x) (regexp-match "^[0-9]*$" x)) (directory-list))
(lambda (a b) (< (string->number a) (string->number b)))))
(sort (filter (lambda (x) (regexp-match #rx"^[0-9]*$" (path->string x))) (directory-list))
(lambda (a b) (< (string->number (path->string a))
(string->number (path->string b))))))
(define mailbox
(let loop ([msgs msgs][p 1])
@ -15,7 +16,7 @@
(let ([header (with-input-from-file msg
(lambda () (read-string (file-size msg))))])
(cons (list
(string->number msg)
(string->number (path->string msg))
p
(file-exists? (format "~abody" msg))
(extract-field "From" header)