diff options
author | Arun Isaac | 2022-07-04 00:29:46 +0530 |
---|---|---|
committer | Arun Isaac | 2022-07-04 00:29:46 +0530 |
commit | 02c19cf48d9ddc36286a7b7527795f46ca647c11 (patch) | |
tree | 02293ddcf129aa6d6581ab6322834e47aa5e76be | |
parent | d4a4b2011b812acfbd4c796a7cdad0c39e78e042 (diff) | |
download | tissue-02c19cf48d9ddc36286a7b7527795f46ca647c11.tar.gz tissue-02c19cf48d9ddc36286a7b7527795f46ca647c11.tar.lz tissue-02c19cf48d9ddc36286a7b7527795f46ca647c11.zip |
bin: Generalize delete-xapian-index to delete-directory.
* bin/tissue (delete-xapian-index): Generalize to delete-directory.
(main): Use delete-directory instead of delete-xapian-index.
-rwxr-xr-x | bin/tissue | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -295,15 +295,14 @@ To get usage information for one of these sub-commands, run (command-line-program) (command-line-program))) -(define (delete-xapian-index) - "Delete xapian index if it exists. Current directory must be at the -top-level of the git repository." - (when (file-exists? %xapian-index) +(define (delete-directory directory) + "Delete DIRECTORY, and the contained files, it if it exists." + (when (file-exists? directory) (for-each (lambda (file) - (delete-file (string-append %xapian-index "/" file))) - (scandir %xapian-index + (delete-file (string-append directory "/" file))) + (scandir directory (negate (cut member <> (list "." ".."))))) - (rmdir %xapian-index))) + (rmdir directory))) (define main (match-lambda* @@ -327,11 +326,11 @@ top-level of the git repository." (string=? (call-with-database %xapian-index (cut Database-get-metadata <> "commit")) current-head)) - (guard (c (else (delete-xapian-index) + (guard (c (else (delete-directory %xapian-index) (display "Building xapian index failed." (current-error-port)) (raise c))) - (delete-xapian-index) + (delete-directory %xapian-index) (call-with-writable-database %xapian-index (lambda (db) (for-each (lambda (indexed-document) |