fix path-join again, for old lua versions

This commit is contained in:
XeroOl 2025-06-06 12:16:58 -05:00
parent cb9f09ba84
commit c644ce54ab

View File

@ -200,7 +200,10 @@ WARNING: this is only used in the test code, not in the real language server"
(λ path-join [path suffix]
(if (absolute-path? suffix) suffix
(= path "") suffix
(let [clean-path (path:gsub "[\\/]?$" path-sep) ; ensure trailing slash
(let [;; ensure trailing slash
;; we need to limit to 1 replacement because old
;; versions of lua can match the pattern twice.
clean-path (path:gsub "[\\/]?$" path-sep 1)
clean-suffix (if (or (= (suffix:sub 1 2) "./")
(= (suffix:sub 1 2) ".\\"))
(suffix:sub 3)