Fix installation of tree-sitter grammar on MS-Windows
* lisp/treesit.el (treesit--install-language-grammar-1): Fix a failure on MS-Windows when the old DLL is still being used. (Bug#61289)
This commit is contained in:
parent
0358267204
commit
f13479d955
1 changed files with 11 additions and 1 deletions
|
@ -2884,7 +2884,17 @@ function signals an error."
|
||||||
;; Copy out.
|
;; Copy out.
|
||||||
(unless (file-exists-p out-dir)
|
(unless (file-exists-p out-dir)
|
||||||
(make-directory out-dir t))
|
(make-directory out-dir t))
|
||||||
|
(let* ((library-fname (expand-file-name lib-name out-dir))
|
||||||
|
(old-fname (concat library-fname ".old")))
|
||||||
|
;; Rename the existing shared library, if any, then
|
||||||
|
;; install the new one, and try deleting the old one.
|
||||||
|
;; This is for Windows systems, where we cannot simply
|
||||||
|
;; overwrite a DLL that is being used.
|
||||||
|
(if (file-exists-p library-fname)
|
||||||
|
(rename-file library-fname old-fname t))
|
||||||
(copy-file lib-name (file-name-as-directory out-dir) t t)
|
(copy-file lib-name (file-name-as-directory out-dir) t t)
|
||||||
|
;; Ignore errors, in case the old version is still used.
|
||||||
|
(ignore-errors (delete-file old-fname)))
|
||||||
(message "Library installed to %s/%s" out-dir lib-name))
|
(message "Library installed to %s/%s" out-dir lib-name))
|
||||||
(when (file-exists-p workdir)
|
(when (file-exists-p workdir)
|
||||||
(delete-directory workdir t)))))
|
(delete-directory workdir t)))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue