diff --git a/src/gempub.lisp b/src/gempub.lisp index e1c0971..be1cf27 100644 --- a/src/gempub.lisp +++ b/src/gempub.lisp @@ -71,6 +71,8 @@ (define-constant +metadata-entry-name+ "metadata.txt" :test #'string=) +(define-constant +gempub-file-extension+ "gpub" :test #'string=) + (defun extract-metadata (zip-file) (when (gempub:gempub-file-p zip-file :ignore-errors t) (let ((entries (zip-info:list-entries zip-file))) diff --git a/src/gui/client/gempub-window.lisp b/src/gui/client/gempub-window.lisp index bd6f4c3..7cf97cb 100644 --- a/src/gui/client/gempub-window.lisp +++ b/src/gui/client/gempub-window.lisp @@ -181,7 +181,9 @@ license copyright cover-filename)) - (os-utils:zip-directory gemtext-directory :flat t))) + (os-utils:zip-directory gemtext-directory + :extension gempub:+gempub-file-extension+ + :flat t))) (defun create-gempub (gemtext-dir) (gui:with-modal-toplevel (toplevel :title (_ "Add Metadata")) diff --git a/src/os-utils.lisp b/src/os-utils.lisp index 3a5a15a..b28e4bf 100644 --- a/src/os-utils.lisp +++ b/src/os-utils.lisp @@ -319,13 +319,16 @@ numerical user ID, as an assoc-list." (when (not (process-exit-success-p process)) (error (format nil (_ "File ~s extraction from ~s failed") file-entry zip-file)))))) -(defun zip-directory (dir &key (flat nil)) +(defun zip-directory (dir &key (extension nil) (flat nil)) (with-output-to-string (stream) (let* ((process (run-external-program +zip-bin+ (append (when flat (list "-j")) (list "-r" - dir + (format nil + "~a~@[.~a~]" + dir + extension) dir)) :search t :wait t diff --git a/src/package.lisp b/src/package.lisp index 2ad9abd..0b4e66e 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -2946,6 +2946,7 @@ (:shadowing-import-from :misc :random-elt :shuffle) (:export :+metadata-entry-name+ + :+gempub-file-extension+ :gempub-file-p :extract-metadata :sync-library