1
0
mirror of https://github.com/janet-lang/janet synced 2024-07-03 10:33:24 +00:00

Pick default bundle name better.

This commit is contained in:
Calvin Rose 2024-05-25 16:09:49 -05:00
parent 750b448f75
commit e88042b2fa

View File

@ -4191,7 +4191,13 @@
(def path (os/realpath path))
(def clean (get config :clean))
(def check (get config :check))
(default bundle-name (last (string/split "/" path)))
(default bundle-name
(let [sep (if (string/find "\\" path) "\\" "/")]
(last (string/split sep path))))
(assert (not (string/check-set "\\/" bundle-name))
(string "bundle-name "
bundle-name
" cannot contain path separators"))
(assert (next bundle-name) "cannot use empty bundle-name")
(assert (not (fexists (get-manifest-filename bundle-name)))
"bundle is already installed")