Method: Packr::FileSystem.relative_path
- Defined in:
- lib/packr/file_system.rb
.relative_path(source, target) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/packr/file_system.rb', line 33 def self.relative_path(source, target) return source unless target target_parts = target.split('/') source_parts = source.split('/') while target_parts.first == source_parts.first target_parts.shift source_parts.shift end ('../' * (target_parts.size-1)) + source_parts.join('/') end |