# File lib/vendor/fssm/fssm/pathname.rb, line 151
    def relative_path_from(base)
      base = self.class.for(base)

      if self.absolute? != base.absolute?
        raise ArgumentError, 'no relative path between a relative and absolute'
      end

      if self.prefix != base.prefix
        raise ArgumentError, "different prefix: #{@prefix.inspect} and #{base.prefix.inspect}"
      end

      base = base.cleanpath!.segments
      dest = dup.cleanpath!.segments

      while !dest.empty? && !base.empty? && dest[0] == base[0]
        base.shift
        dest.shift
      end

      base.shift if base[0] == '.'
      dest.shift if dest[0] == '.'

      if base.include?('..')
        raise ArgumentError, "base directory may not contain '..'"
      end

      path = base.fill('..') + dest
      path = self.class.join(*path)
      path = self.class.new('.') if path.empty?

      path
    end