# File lib/chef-config/path_helper.rb, line 28
    def self.dirname(path)
      if ChefConfig.windows?
        # Find the first slash, not counting trailing slashes
        end_slash = path.size
        loop do
          slash = path.rindex(/[#{Regexp.escape(File::SEPARATOR)}#{Regexp.escape(path_separator)}]/, end_slash - 1)
          if !slash
            return end_slash == path.size ? "." : path_separator
          elsif slash == end_slash - 1
            end_slash = slash
          else
            return path[0..slash - 1]
          end
        end
      else
        ::File.dirname(path)
      end
    end