Modifying the PATH envariable

R

Robert James

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?
 
R

Robert James

Robert said:
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?
 
J

Jan Svitok

Robert said:
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.

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
 

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
474,222
Messages
2,571,140
Members
47,755
Latest member
Grazynkaa

Latest Threads

Top