diff --git a/src/dodb.cl b/src/dodb.cl index 71c0710..e7e588b 100644 --- a/src/dodb.cl +++ b/src/dodb.cl @@ -46,6 +46,8 @@ (data (make-hash-table)) ; {Int -> struct} ) +; db/new ensures directory '/data/' exist, +; then loads values from existing files, if any, and puts them into db-data. (defun db/new (struct-name path) (ensure-directories-exist (concatenate 'string path "/data/")) @@ -130,7 +132,9 @@ ; Generate index for all DB elements. (maphash #'(lambda (number element) - (db/index/new database attribute-name element (number->filename number))) + (handler-case (db/index/new database attribute-name element (number->filename number)) + (OSICAT-POSIX:EEXIST () + (format t "db/new-index: symlink already exists, ignoring.~&")))) (db-data database))) ; example: db-path/partitions/by_color/ @@ -144,7 +148,9 @@ ; Generate partition for all DB elements. (maphash #'(lambda (number element) - (db/partition/new database attribute-name element (number->filename number))) + (handler-case (db/partition/new database attribute-name element (number->filename number)) + (OSICAT-POSIX:EEXIST () + (format t "db/new-partition: symlink already exists, ignoring.~&")))) (db-data database))) ; Example: database -> "000000000000018".