Find default system paths

 @param [String] path
   the path to search through

 @example
   search_paths("/usr/local/bin:/bin")
   # => ['/bin']

 @return [Array[String]]
   the array of paths to search

 @api private
195878
def search_paths(path = ENV['PATH'])
      paths = if path && !path.empty?
                path.split(::File::PATH_SEPARATOR)
              else
                %w(/usr/local/bin /usr/ucb /usr/bin /bin)
              end
      paths.select(&Dir.method(:exist?))
    end
720589
def find_binary(self, binary):
        
        if os.path.exists(binary):
            return binary

        # Extract out the filename if we were given a full path
        binary_name = os.path.basename(binary)

        # Gather $PATH
        search_paths = os.environ['PATH'].split(':')

        # Extra paths to scan...
        default_paths = [
            '/usr/bin',
            '/bin'
            '/usr/local/bin',
            '/usr/sbin',
            '/sbin'
            '/usr/local/sbin',
        ]

        for path in default_paths:
            if path not in search_paths:
                search_paths.append(path)

        for path in search_paths:
            if os.path.isdir(path):
                filename = os.path.join(path, binary_name)
                if os.path.exists(filename):
                    return filename

        return binary
166389
def find_vagrantfile(search_path, filenames=nil)
      filenames ||= ["Vagrantfile", "vagrantfile"]
      filenames.each do |vagrantfile|
        current_path = search_path.join(vagrantfile)
        return current_path if current_path.file?
      end

      nil
    end
980739
def load_path(path)
      path = path.to_s
      check_error_string do
        @path = Pathname.new(path)
        load_path_impl(path)
      end
      self
    end
378583
def selectReceivePath(self, paths):
        
        logger.debug("%s", paths)

        if not paths:
            path = os.path.basename(self.userPath) + '/Anon'

        try:
            # Relative paths are preferred
            path = [p for p in paths if not p.startswith("/")][0]
        except IndexError:
            # If no relative path, just use the first path
            path = os.path.relpath(list(paths)[0], self.userPath)

        return self._fullPath(path)
561138
def find(path, saltenv='base'):
    '''
    
    '''
    # Return a list of paths + text or bin
    ret = []
    if saltenv not in __opts__['pillar_roots']:
        return ret
    for root in __opts__['pillar_roots'][saltenv]:
        full = os.path.join(root, path)
        if os.path.isfile(full):
            # Add it to the dict
            with salt.utils.files.fopen(full, 'rb') as fp_:
                if salt.utils.files.is_text(fp_):
                    ret.append({full: 'txt'})
                else:
                    ret.append({full: 'bin'})
    return ret
234098
def paths=(raw_paths)
    raw_paths = [raw_paths] unless raw_paths.respond_to? :each

    @paths = raw_paths.map { |path| Pathname.new(path) }
  end
1103897
def glob_directory(path)
      results = ::Dir[path]

      return results unless RUBY_PLATFORM =~ /darwin/

      results.map { |r| r.encode('UTF-8', 'UTF-8-MAC') }
    end
1266860
def resource_path(*args)
      options = args.extract_options!
      super_path(with_nesting(args.first || resource), options)
    end
890021
def find_in_path(name, path):
    ""
    # adapted fom http://code.activestate.com/recipes/52224-find-a-file-given-a-search-path/
    for dir in path.split(os.pathsep):
        binpath = os.path.join(dir, name)
        if os.path.exists(binpath):
            return os.path.abspath(binpath)
    return None
1226759
def relpath(self, path):
        
        for root in self.roots:
            # Root is regex, convert to matching root string
            if isinstance(root, Pattern):
                match = root.match(path)
                if not match:
                    continue
                root = match.group(0)

            # Split root and relative path
            try:
                relative = path.split(root, 1)[1]
                # Strip "/" only at path start. "/" is used to known if
                # path is a directory on some cloud storage.
                return relative.lstrip('/')
            except IndexError:
                continue

        return path
1170808
def normalize_path(path)
      if path.is_a?(String)
        path.split(':')
      elsif path.respond_to?(:each)
        path
      else
        [path]
      end
    end
264273
def get_path(name, scheme=_get_default_scheme(), vars=None, expand=True):
    
    return get_paths(scheme, vars, expand)[name]
181353
def normalize_path(path)
      raise "abnormal path `#{path}'" if path[0] != ?/
      ret = path.dup

      ret.gsub!(%r{/+}o, '/')                    # //      => /
      while ret.sub!(%r'/\.(?:/|\Z)', '/'); end  # /.      => /
      while ret.sub!(%r'/(?!\.\./)[^/]+/\.\.(?:/|\Z)', '/'); end # /foo/.. => /foo

      raise "abnormal path `#{path}'" if %r{/\.\.(/|\Z)} =~ ret
      ret
    end
539284
def path_exist? path
      if path.is_a? Pathname
        return path.exist?
      elsif path.is_a? String
        return Pathname.new(path).exist?
      else
        return false
      end
    end
713610
def paths
      {}.tap do |result|
        shell.hg('paths').each_line do |line|
          path, url = *line.strip.split(" = ")
          result[path] = url
        end
      end
    end
155795
def find_all(*logical_paths, &block)
      return to_enum(__method__, *logical_paths) unless block_given?

      options = extract_options!(logical_paths)
      base_path = (options[:base_path] || root).to_s

      logical_paths.each do |logical_path|
        logical_path = logical_path.sub(/^\//, '')

        if relative?(logical_path)
          find_in_base_path(logical_path, base_path, &block)
        else
          find_in_paths(logical_path, &block)
        end
      end

      nil
    end