Get __FILE__ of compiled script

Viewed 117

How can I get the compiled version of my Crystal script to get its own __FILE__. Here is an example. I have a file called ~/test.cr with the following contents:

puts __FILE__

I compile the script via Crystal

~$ crystal ~/test.cr -o ~/test.compiled

Next I run ~/test.compiled. I produces the result

/Users/Account1/test.cr

even though the __FILE__ is actually

/Users/Account1/test.compiled

Is there a way to make it produce

/Users/Account1/test.compiled

Instead of

/Users/Account1/test.cr
1 Answers
Related