babashka / bbin

Install any Babashka script or project with one command
MIT License
139 stars 9 forks source link

local installs without aliases throw exception on Windows #37

Closed bobisageek closed 2 years ago

bobisageek commented 2 years ago

pre-emptive apology I don't mean to be the "but what about Windows?" guy, but...

problem statement Installing a local clj on Windows throws:

>bbin version
bbin 0.1.3

>bbin install hellocal.clj
{:coords {:bbin/url "file://C:\\testing_stuff\\hellocal.clj"}}
----- Error --------------------------------------------------------------------
Type:     java.lang.IllegalArgumentException
Message:  C:\testing-stuff\hellocal is not a relative path
Location: C:\path\to\bbin:398:38
...
398:         script-file (fs/canonicalize (fs/file (util/bin-dir cli-opts) script-name)
                                          ^--- C:\testing-stuff\hellocal is not a relative path
... (longer details elided for brevity)

but works if an alias is supplied:

>bbin install hellocal.clj --as hellocal
{:coords {:bbin/url "file://C:\\testing_stuff\\hellocal.clj"}}

analysis

I haven't started on a PR yet, but a little thinking about it raised another question in my head: The current file-path->script-name takes the first split of the file name on .. Would it be desirable to drop the extension instead? By which I mean 'foo.bar.clj' would be installed as 'foo.bar'. I realize this is very unlikely to make a difference because of namespace names and what not, but I was considering using fs/strip-ext in the PR, which would technically be different in the edge case.

rads commented 2 years ago

No need to apologize, that’s my bad. I created an issue to get Windows in CI so these things can be caught before release.

https://github.com/babashka/bbin/issues/41

rads commented 2 years ago

Resolved in #38.