1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

make-directory now returns t if dir already exists

This new feature will help fix a copy-directory bug (Bug#58919).
Its implementation does not rely on make-directory handlers
supporting the new feature, as it no longer uses a make-directory
handler H in any way other than (funcall H DIR), thus using
only the intersection of the old and new behavior for handlers.
This will give us time to fix handlers at our leisure.
* lisp/files.el (files--ensure-directory): New arg MKDIR.
All uses changed.
(files--ensure-directory, make-directory):
Return non-nil if DIR is already a directory.  All uses changed.
* test/lisp/files-tests.el (files-tests-make-directory):
Test new return-value convention.
This commit is contained in:
Paul Eggert 2022-12-17 12:15:30 -08:00
parent 8a9579ca29
commit bef1edc9ca
4 changed files with 41 additions and 31 deletions

View file

@ -1261,11 +1261,11 @@ works as expected if the default directory is quoted."
(a/b (concat dirname "a/b")))
(write-region "" nil file)
(should-error (make-directory "/"))
(should-not (make-directory "/" t))
(should (make-directory "/" t))
(should-error (make-directory dir))
(should-not (make-directory dir t))
(should (make-directory dir t))
(should-error (make-directory dirname))
(should-not (make-directory dirname t))
(should (make-directory dirname t))
(should-error (make-directory file))
(should-error (make-directory file t))
(should-not (make-directory subdir1))