class File

def self.relative_path(from, to)

Returns:
  • (String) - the relative path from +from+ to +to+.

Parameters:
  • to (String) -- the final path that should be made relative.
  • from (String) -- the starting filename
def self.relative_path(from, to)
  from = expand_path(from).split(SEPARATOR)
  to = expand_path(to).split(SEPARATOR)
  from.length.times do
    break if from[0] != to[0]
    from.shift; to.shift
  end
  from.pop
  join(*(from.map { RELATIVE_PARENTDIR } + to))
end