Top Level Namespace

Defined Under Namespace

Classes: VboxTools

Instance Method Summary collapse

Instance Method Details

#which(cmd, *additional) ⇒ Object



230
231
232
233
234
235
236
237
238
239
240
# File 'lib/vbox_tools.rb', line 230

def which( cmd, *additional )
  paths = ENV['PATH'].split( File::PATH_SEPARATOR )
  if ( additional )
    paths += additional
  end
  
  return paths.map { |path|
    file = File.join( path, cmd )
    ( File.exist?( file ) ) ? file : nil
  }.compact.first
end