Forum: Ruby Re: Full paths of Ruby interpreter and running script

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Berger, Daniel (Guest)
on 2006-04-17 18:03
(Received via mailing list)
> from within a running program. I want to distribute a program
> that can be installed in a folder chosen by the user.  The
> program would save configuration information in the same
> folder. In order to find the configuration file at runtime, I
> thought I would query the full path of the Ruby interpreter
> or script file.  In case it makes a difference, I'm using Windows.
>
> Jamal

Is this what you're after?

require 'rbconfig'
include Config

puts CONFIG['bindir'] # c:/ruby/bin

Regards,

Dan
unknown (Guest)
on 2006-04-17 18:16
(Received via mailing list)
On Tue, 18 Apr 2006, Berger, Daniel wrote:

>> from within a running program. I want to distribute a program
> require 'rbconfig'
> include Config
>
> puts CONFIG['bindir'] # c:/ruby/bin
>
> Regards,

i use this

   c = ::Config::CONFIG
   File::join(c['bindir'], c['ruby_install_name']) << c['EXEEXT']

cheers.


-a
This topic is locked and can not be replied to.