summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorArun Isaac2022-07-04 17:39:52 +0530
committerArun Isaac2022-07-04 18:22:36 +0530
commit9baa47d22625288932a1872528a10d721d509b05 (patch)
tree490a26a981ee310d24f0f933f8d2ee642143c87b /bin
parente26fbe669425090cc294aa873a85d1f30e84caca (diff)
downloadtissue-9baa47d22625288932a1872528a10d721d509b05.tar.gz
tissue-9baa47d22625288932a1872528a10d721d509b05.tar.lz
tissue-9baa47d22625288932a1872528a10d721d509b05.zip
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.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/tissue14
1 files 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)