From c644ce54ab5af2a2dfbc1583eb37865e4db5208a Mon Sep 17 00:00:00 2001 From: XeroOl Date: Fri, 6 Jun 2025 12:16:58 -0500 Subject: [PATCH] fix path-join again, for old lua versions --- src/fennel-ls/utils.fnl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fennel-ls/utils.fnl b/src/fennel-ls/utils.fnl index 98d081a..7c25313 100644 --- a/src/fennel-ls/utils.fnl +++ b/src/fennel-ls/utils.fnl @@ -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)