Skip to content

Commit 616274a

Browse files
committed
langs: Handle languages with hyphens in name
1 parent 2898b0a commit 616274a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tree-sitter-langs-build.el

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,14 @@ current state of the grammar repo, without cleanup."
228228
(let ((default-directory (file-name-as-directory (concat dir path))))
229229
(tree-sitter-langs--call "tree-sitter" "generate")
230230
(tree-sitter-langs--call "tree-sitter" "test")))
231+
;; Replace underscores with hyphens. Example: c_sharp.
232+
(let ((default-directory tree-sitter-langs--bin-dir))
233+
(dolist (file (directory-files default-directory))
234+
(when (string-match "_" file)
235+
(let ((new-name (replace-regexp-in-string "_" "-" file)))
236+
(when (file-exists-p new-name)
237+
(delete-file new-name))
238+
(rename-file file new-name)))))
231239
;; On macOS, rename .so => .dylib, because we will make a "universal"
232240
;; bundle.
233241
(when (eq system-type 'darwin)

0 commit comments

Comments
 (0)