     } else if components.first == Path.separator && components.count > 1 {
       let p = components.joined(separator: Path.separator)
 #if os(Linux)
-      let index = p.startIndex.distanceTo(p.startIndex.successor())
+      let index = p.startIndex.distance( to: p.startIndex.successor())
       path = NSString(string: p).substringFromIndex(index)
 #else
       path = p.substring(from: p.startIndex.successor())

    #if !swift(>=3.0)
    try NSString(string: string).writeToFile(normalize().path, atomically: true, encoding: encoding)
    #else
    try NSString(string: string).write(toFile:normalize().path, atomically: true, encoding: encoding)
    #endif
  }
}

    #if !swift(>=3.0)
    try Path.fileManager.createDirectoryAtPath(self.path, withIntermediateDirectories: true, attributes: nil)
    #else
      #if os(Linux)
      try Path.fileManager.createDirectoryAtPath(self.path, withIntermediateDirectories: true, attributes: nil)
      #else
      try Path.fileManager.createDirectory(atPath: self.path, withIntermediateDirectories: true, attributes: nil)
      #endif
    #endif
  }

