in a `.main.kts` can i use `@file:Repositry` to p...
# scripting
n
in a
.main.kts
can i use
@file:Repositry
to point to a local folder repository ?
Copy code
@file:Repository("/home/nikky/dev/forks/github-actions-kotlin-dsl/localRepo/")
does not seem to work or do repostories for this need to be http based ?
e
I would expect
Copy code
@file:Repository("file:/home/nikky/dev/forks/github-actions-kotlin-dsl/localRepo/")
or something similar to work, have you tried?
👆 1
b
Might need double slashes file://
n
it worked better with
file:///home/nikky/...
b
Hah, one can never have too many slashes 😀 I guess the first two are part of the protocol, just like https:// and the third is part of the path so it all makes sense
✅ 1
n
i wonder if a relative path is relative to current working directory or the script file location.. the latter would be somewhat useful..
b
It will be relative to invocation dir (pwd), not script dir, but should work just fine
e
I'm surprised, because in Java,
Copy code
new File("/home").toURI().toString().equals("file:/home")
which is indeed inconsistent with how everybody else handles file URIs, but that's just how it is… well, as long as it works
v
Actually the third is separator between hostname and path and is the only mandatory one. The first two are part of the hostname, where the actual hostname can be omitted and defaults to
localhost
. It can be legally omitted completely, resulting in only one slash, but not all parsers support that properly.
Two slashes and relative paths are not possible, at least not in the standard
e
I thought the //authority was required in hierarchical URIs, but checking the standards now, I got it backwards: it's that opaque URIs do not have an authority
and I guess you're just supposed to know which schemes are opaque and which are hierarchical
v
Also afair the file uri standard was written after many usage were existing already and the standard tried to cover most of them or something like that.