Tar2rubyscript: getting the path of the original executable

Hi,

I try using tar2rubyscript and I need to get the path to the original
executable. oldlocation doesn’t seem to help because it referes to the
original working directory. Any idea?

Patrick


$ cat application/init.rb
p $0
p FILE

$ ruby tar2rubyscript.rb application/
Creating archive…
Creating application.rb …

$ ruby application.rb
“…/Temp/tar2rubyscript.d.2900.1/application/init.rb”
“…/Temp/tar2rubyscript.d.2900.1/application/init.rb”

Erik V. wrote:


$ cat application/init.rb
p $0
p FILE

Thanks Erik, but obviously I wasn’t clear. I need the path to the old
.rb file, the one that is distributed and contains the tar file, not the
one in the temporary directory.

With FILE and $0 I get the new location, with oldlocation I only get
the last PWD and not the location of the tar/rb file.

Patrick

Erik V. wrote:

Sorry, I misunderstood your question…

Currently, it’s not possible to determine the path to the RBA.

Mmm…

Then I have two suggestions for tar2rubyscript:

  1. create an environment variable that points to the RBA
  2. make the filename ‘init.rb’ configurable

Thanks in advance,

Patrick

Sorry, I misunderstood your question…

Currently, it’s not possible to determine the path to the RBA.

Mmm…

gegroet,
Erik V. - http://www.erikveen.dds.nl/