import PathKit

extension Path {
    func absolutePath(relativeTo directory: Path) -> Path {
        assert(directory.isAbsolute)
        if isAbsolute {
            return self
        } else {
            return (directory + self).absolute()
        }
    }

    func relativePath(from directory: Path) -> Path {
        assert(directory.isAbsolute)
        guard isAbsolute else {
            return self
        }

        let components = self.components
        let index: Int = {
            let directoryComponents = directory.components
            for (i, (c1, c2)) in zip(components, directoryComponents).enumerated() {
                if c1 != c2 {
                    return i
                }
            }

            return Swift.min(directoryComponents.count, components.count)
        }()
        
        return Path(components: components[index ..< components.endIndex])
    }
}

import PathKit

extension Path {
    func absolutePath(relativeTo directory: Path) -> Path {
        assert(directory.isAbsolute)
        if isAbsolute {
            return self
        } else {
            return directory + self
        }
    }

    func relativePath(from directory: Path) -> Path {
        assert(directory.isAbsolute)
        guard isAbsolute else {
            return self
        }

        let components = self.components
        let index: Int = {
            let directoryComponents = directory.components
            for (i, (c1, c2)) in zip(components, directoryComponents).enumerated() {
                if c1 != c2 {
                    return i
                }
            }

            return Swift.min(directoryComponents.count, components.count)
        }()
        
        return Path(components: components[index ..< components.endIndex])

    }
}

--- 
+++ 
@@ -6,7 +6,7 @@
         if isAbsolute {
             return self
         } else {
-            return directory + self
+            return (directory + self).absolute()
         }
     }
 
@@ -29,6 +29,5 @@
         }()
         
         return Path(components: components[index ..< components.endIndex])
-
     }
 }
Make Path.absolutePath() return an absolute path
