From 9baa47d22625288932a1872528a10d721d509b05 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 4 Jul 2022 17:39:52 +0530 Subject: bin: Deprecate delete-directory in favor of guile-filesystem. * bin/tissue: Import (ice-9 filesystem). (delete-directory): Delete function. (index): Use delete-file-recursively instead of delete-directory. --- bin/tissue | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/bin/tissue b/bin/tissue index 60e3769..2f3e7a6 100755 --- a/bin/tissue +++ b/bin/tissue @@ -28,6 +28,7 @@ exec guile --no-auto-compile -s "$0" "$@" (srfi srfi-37) (srfi srfi-171) (srfi srfi-171 gnu) + (ice-9 filesystem) (ice-9 ftw) (ice-9 match) (ice-9 popen) @@ -295,15 +296,6 @@ To get usage information for one of these sub-commands, run (command-line-program) (command-line-program))) -(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 directory "/" file))) - (scandir directory - (negate (cut member <> (list "." ".."))))) - (rmdir directory))) - (define (index db-path) "Index current repository into xapian database at DB-PATH. If DB-PATH already exists and is up to date, do nothing." @@ -313,11 +305,11 @@ already exists and is up to date, do nothing." (string=? (call-with-database db-path (cut Database-get-metadata <> "commit")) current-head)) - (guard (c (else (delete-directory db-path) + (guard (c (else (delete-file-recursively db-path) (format (current-error-port) "Building xapian index failed.~%") (raise c))) - (delete-directory db-path) + (delete-file-recursively db-path) (call-with-writable-database db-path (lambda (db) (for-each (lambda (indexed-document) -- cgit v1.2.3