Method: Thor::Actions#relative_to_original_destination_root

Defined in:
lib/thor/actions.rb

#relative_to_original_destination_root(path, remove_dot = true) ⇒ Object

Returns the given path relative to the absolute root (ie, root where the script started).

[View source]

114
115
116
117
118
119
120
121
122
123
# File 'lib/thor/actions.rb', line 114

def relative_to_original_destination_root(path, remove_dot = true)
  root = @destination_stack[0]
  if path.start_with?(root) && [File::SEPARATOR, File::ALT_SEPARATOR, nil, ""].include?(path[root.size..root.size])
    path = path.dup
    path[0...root.size] = "."
    remove_dot ? (path[2..-1] || "") : path
  else
    path
  end
end