tar2rubyscript: getting the path of the original executable

P

Patrick Gundlach

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
 
E

Erik Veenstra

----------------------------------------------------------------

$ 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"

----------------------------------------------------------------
 
P

Patrick Gundlach

Erik said:
----------------------------------------------------------------

$ 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
 
P

Patrick Gundlach

Erik said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top