# File lib/pathutil.rb, line 639
  def conservative_cleanpath
    _out = split_path.each_with_object([]) do |part, out|
      next if part == "." || (part == ".." && out.last == "")
      out.push(
        part
      )
    end

    # --

    if !_out.empty? && basename == "." && _out.last != "" && _out.last != ".."
      _out << "."
    end

    # --

    return self.class.new("/") if _out == [""].freeze
    return self.class.new(".") if _out.empty? && (end_with?(".") || relative?)
    return self.class.new(_out.join("/")).join("") if @path =~ %r!/\z! \
      && _out.last != "." && _out.last != ".."
    self.class.new(_out.join("/"))
  end