Commit c688ee29 authored by Johannes Schriewer's avatar Johannes Schriewer

Linux is missing some of the new foundation code, so we stub it

parent 578fa7c7
Pipeline #1206 failed with stage
......@@ -26,7 +26,7 @@ final public class ExternalDependency {
public var name: String {
let lastComponent = gitURL.toNSString.lastPathComponent
if lastComponent.hasSuffix(".git") {
return lastComponent.toNSString.substringToIndex(lastComponent.characters.count - 4)
return lastComponent.toNSString.substring(to: lastComponent.characters.count - 4)
}
return lastComponent
}
......
......@@ -24,7 +24,7 @@ extension String {
#endif
}
#if os(Linux)
public func subStringWithRange(range: Range<String.Index>) -> String {
public func substring(with range: Range<String.Index>) -> String {
var result = ""
result.reserveCapacity(range.count)
for idx in range {
......@@ -33,8 +33,8 @@ extension String {
return result
}
public func substringToIndex(index: Int) -> String {
return self.subStringWithRange(self.startIndex..<self.startIndex.advanced(by:index))
public func substring(to index: Int) -> String {
return self.substring(with: self.startIndex..<self.startIndex.advanced(by:index))
}
#endif
}
......@@ -78,5 +78,9 @@ extension NSString {
var deletingLastPathComponent: String {
return self.stringByDeletingLastPathComponent
}
func substring(to index: Int) -> String {
return self.substringToIndex(index)
}
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment