lib/build/files/path.rb in build-files-0.2.9 vs lib/build/files/path.rb in build-files-0.3.0
- old
+ new
@@ -40,10 +40,10 @@
def self.shortest_path(path, root)
path_components = Path.components(path)
root_components = Path.components(root)
# Find the common prefix:
- i = prefix_length(path_components, root_components)
+ i = prefix_length(path_components, root_components) || 0
# The difference between the root path and the required path, taking into account the common prefix:
up = root_components.size - i
return File.join([".."] * up + path_components[i..-1])