Forum: Ruby Modifying the PATH envariable

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.
53a1f0aba6f0489d49f5e6fc3df323fa?d=identicon&s=25 Robert James (robertjames)
on 2007-01-12 10:59
Our app invokes some binary executables (imagine `convert image.png`).
In order to make deployment error free, I'd like to include them in our
source tree, and add the paths to the ENV['PATH'] dynamically.

Is there a cross platform way of doing this?  Unix uses ':' as a path
separator, Windows uses ';'.

In case you're wondering how the binaries can be cross platform.
Imaging:
/vendor/bin/i386-linux/
/vendor/bin/i386-mswin32/
require 'rbconfig'
add_to_path('vendor/bin/' + Config::CONFIG['arch'] + '/')

Not sure how to compile cross Linux binaries, though - they're often
dependent on the distro and even version.  Is it enough to compile them
statically linked?
53a1f0aba6f0489d49f5e6fc3df323fa?d=identicon&s=25 Robert James (robertjames)
on 2007-01-14 00:40
Robert James wrote:
> Our app invokes some binary executables (imagine `convert image.png`).
> In order to make deployment error free, I'd like to include them in our
> source tree, and add the paths to the ENV['PATH'] dynamically.
>
> Is there a cross platform way of doing this?  Unix uses ':' as a path
> separator, Windows uses ';'.
>
> Not sure how to compile cross Linux binaries, though - they're often
> dependent on the distro and even version.  Is it enough to compile them
> statically linked?

Can anyobdy get me started with this?
97550977337c9f0a0e1a9553e55bfaa0?d=identicon&s=25 Jan Svitok (Guest)
on 2007-01-19 16:31
(Received via mailing list)
On 1/14/07, Robert James <srobertjames@gmail.com> wrote:
> Robert James wrote:
> > Our app invokes some binary executables (imagine `convert image.png`).
> > In order to make deployment error free, I'd like to include them in our
> > source tree, and add the paths to the ENV['PATH'] dynamically.

If it's in the source tree, maybe you can use full paths in the
invocation.

> > Is there a cross platform way of doing this?  Unix uses ':' as a path
> > separator, Windows uses ';'.

File::PATH_SEPARATOR, http://www.rubycentral.com/book/ref_c_file.html
ENV['PATH'] << File::PATH_SEPARATOR << 'new.dir'

See also File::SEPARATOR and File#join
This topic is locked and can not be replied to.