class ChefCLI::CLI
def path_check!
when they have the embedded_bin_dir before the omnibus_bin_dir -- both of which will
catch the cases where users setup only the embedded_bin_dir in their path, or
def path_check! # When installed outside of omnibus, trust the user to configure their PATH return true unless omnibus_install? paths = env[path_key].split(File::PATH_SEPARATOR) paths.map! { |p| drive_upcase(Chef::Util::PathHelper.cleanpath(p)) } embed_index = paths.index(drive_upcase(Chef::Util::PathHelper.cleanpath(omnibus_embedded_bin_dir))) bin_index = paths.index(drive_upcase(Chef::Util::PathHelper.cleanpath(omnibus_bin_dir))) if embed_index if bin_index if embed_index < bin_index err("WARN: #{omnibus_embedded_bin_dir} is before #{omnibus_bin_dir} in your #{path_key}, please reverse that order.") err("WARN: consider using `#{ChefCLI::Dist::EXEC} shell-init <shell>` command to setup your environment correctly.") end else err("WARN: only #{omnibus_embedded_bin_dir} is present in your path, you must add #{omnibus_bin_dir} before that directory.") err("WARN: consider using `#{ChefCLI::Dist::EXEC} shell-init <shell>` command to setup your environment correctly.") end end end