Class: Bwrap::Execution::Path::Environment Private
- Inherits:
-
Object
- Object
- Bwrap::Execution::Path::Environment
- Defined in:
- lib/bwrap/execution/path.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Utilities to handle environment path operations.
Class Method Summary collapse
-
.each_env_path(command, env_path_var: ENV.fetch("PATH", nil)) {|path| ... } ⇒ Object
private
Loop through each path in global PATH environment variable to perform an operation in each path, for example to resolve absolute path to a command.
Class Method Details
.each_env_path(command, env_path_var: ENV.fetch("PATH", nil)) {|path| ... } ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Loop through each path in global PATH environment variable to perform an operation in each path, for example to resolve absolute path to a command.
NOTE: This has nothing to do with Config#env_paths, as the env paths looped are what the system has defined, in ENV.
Should be cross-platform.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/bwrap/execution/path.rb', line 23 def self.each_env_path command, env_path_var: ENV.fetch("PATH", nil) exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [ "" ] env_path_var.split(File::PATH_SEPARATOR).each do |env_path| exts.each do |ext| exe = File.join(env_path, "#{command}#{ext}") yield exe end end end |