[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

tar2rubyscript: getting the path of the original executable

Patrick Gundlach

1/23/2007 1:52:00 PM

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

--
Posted via http://www.ruby-....

4 Answers

Erik Veenstra

1/23/2007 5:03:00 PM

0

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

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

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


Patrick Gundlach

1/23/2007 5:17:00 PM

0

Erik Veenstra 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

--
Posted via http://www.ruby-....

Erik Veenstra

1/23/2007 5:55:00 PM

0

Sorry, I misunderstood your question...

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

Mmm...

gegroet,
Erik V. - http://www.erikve...


Patrick Gundlach

1/26/2007 9:29:00 AM

0

Erik Veenstra 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

--
Posted via http://www.ruby-....