I just realized that for a `.main.kts` script, `ar...
# scripting
s
I just realized that for a
.main.kts
script,
args[0]
does not refer to the script itself (like known prom other programming languages), but to first script argument (meaning you'll get an
ArrayIndexOutOfBoundsException
if you try to access it while passing no arguments to the script). So, it there another way to get the script's location from the script itself, in order to construct paths relative to it?
Ah,
Copy code
__FILE__
does the trick.
☝️ 1
Is there a reference for all such built-in variables somewhere?
v
Afaik it is the only one
👍🏻 1
Afaik it is the only one
Or well, it depends on the script host used what is available or something like that.