Merge branch 'improve-ensure-directories-exist' into 'develop'

ensure-directories-exist: minor improvements

See merge request embeddable-common-lisp/ecl!340
This commit is contained in:
Daniel Kochmański 2025-03-17 20:23:42 +00:00
commit 7e3dc96fa5
3 changed files with 11 additions and 8 deletions

View file

@ -1193,7 +1193,9 @@ si_mkdir(cl_object directory, cl_object mode)
#endif
ecl_enable_interrupts();
if (ecl_unlikely(ok < 0)) {
if (ok < 0 && errno == EEXIST) {
@(return ECL_NIL);
} else if (ecl_unlikely(ok < 0)) {
cl_object c_error = _ecl_strerror(errno);
const char *msg = "Could not create directory ~S"
"~%C library error: ~S";

View file

@ -1114,7 +1114,7 @@
(proclamation ext:mkstemp (pathname-designator) (or null pathname))
(proclamation ext:copy-file (pathname-designator pathname-designator) gen-bool)
(proclamation si:mkdir (pathname-designator unsigned-byte) string)
(proclamation si:mkdir (pathname-designator unsigned-byte) (or string null))
(proclamation si:rmdir (pathname-designator) null)

View file

@ -292,12 +292,13 @@ where CREATED is true only if we succeeded on creating all directories."
(dolist (item (pathname-directory full-pathname))
(setf d (nconc d (list item)))
(let* ((p (make-pathname :directory d :defaults *default-pathname-defaults*)))
(unless (or (symbolp item) (si::file-kind p nil))
(setf created t)
(let ((ps (namestring p)))
(when verbose
(format t "~%;;; Making directory ~A" ps))
(si::mkdir ps mode)))))
(unless (symbolp item)
(let* ((ps (namestring p))
(newly-created (si::mkdir ps mode)))
(when newly-created
(setf created t)
(when verbose
(format t "~%;;; Making directory ~A" ps)))))))
(values pathname created))))
(defmacro with-hash-table-iterator ((iterator package) &body body)