Method: MTBuild::Utils.path_difference

Defined in:
lib/mtbuild/utils.rb

.path_difference(root, subdir) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/mtbuild/utils.rb', line 7

def self.path_difference(root, subdir)
  root_path = Pathname.new(root)
  subdir_path = Pathname.new(subdir)
  difference_path = subdir_path.relative_path_from(root_path)
  difference = difference_path.to_path
  return nil if difference.include? '..'
  return '' if difference.eql? '.'
  return difference
end