[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 f13479d955: Fix installation of tree-sitter grammar on MS-Windo
From: |
Eli Zaretskii |
Subject: |
emacs-29 f13479d955: Fix installation of tree-sitter grammar on MS-Windows |
Date: |
Sun, 5 Feb 2023 04:14:54 -0500 (EST) |
branch: emacs-29
commit f13479d95566e234a70001f02d4209f145e3729a
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
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)
---
lisp/treesit.el | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 948016dc72..7e31da95ef 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -2884,7 +2884,17 @@ function signals an error."
;; Copy out.
(unless (file-exists-p out-dir)
(make-directory out-dir t))
- (copy-file lib-name (file-name-as-directory out-dir) t 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)
+ ;; 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))
(when (file-exists-p workdir)
(delete-directory workdir t)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 f13479d955: Fix installation of tree-sitter grammar on MS-Windows,
Eli Zaretskii <=