Commit 14f4a79f authored by Drew's avatar Drew

Remove foundation hacks

These are no longer necessary on swift-DEVELOPMENT-SNAPSHOT-2016-01-25-a
parent ff289aaa
Pipeline #853 failed with stage
......@@ -23,8 +23,8 @@ public func collectSources(sourceDescriptions: [String], task: Task) -> [String]
let description = task.importedPath + unPrefixedDescription
if description.hasSuffix("**.swift") {
let basepath = String(Array(description.characters)[0..<description.characters.count - 9])
guard let enumerator = ICantBelieveItsNotFoundation_enumeratorAtPath(basepath) else {
let manager = NSFileManager.defaultManager()
guard let enumerator = manager.enumeratorAtPath(basepath) else {
fatalError("Invalid path \(basepath)")
}
while let source_ns = enumerator.nextObject() as? NSString {
......
......@@ -23,11 +23,6 @@ extension String {
return (self as NSString)
#endif
}
#if os(Linux)
public func stringByReplacingOccurrencesOfString(target: String, withString replacement: String) -> String {
return self.bridge().stringByReplacingOccurrencesOfString(target, withString: replacement)
}
#endif
}
extension NSString {
var toString: String {
......@@ -38,48 +33,3 @@ extension NSString {
#endif
}
}
//enumeratorAtPath isn't implemented
//https://github.com/apple/swift-corelibs-foundation/pull/232 upstreams this code.
class ICantBelieveItsNotNSDirectoryEnumerator {
let baseURL: NSURL
let innerEnumerator : NSDirectoryEnumerator
var fileAttributes: [String : AnyObject]? {
fatalError("Not implemented")
}
var directoryAttributes: [String : AnyObject]? {
fatalError("Not implemented")
}
/* This method returns the number of levels deep the current object is in the directory hierarchy being enumerated. The directory passed to -enumeratorAtURL:includingPropertiesForKeys:options:errorHandler: is considered to be level 0.
*/
var level: Int {
fatalError("Not implemented")
}
func skipDescendants() {
fatalError("Not implemented")
}
init?(path: String) {
let url = NSURL(fileURLWithPath: path)
self.baseURL = url
guard let ie = NSFileManager.defaultManager().enumeratorAtURL(url, includingPropertiesForKeys: nil, options: NSDirectoryEnumerationOptions(), errorHandler: nil) else {
return nil
}
self.innerEnumerator = ie
}
func nextObject() -> AnyObject? {
let o = innerEnumerator.nextObject()
guard let url = o as? NSURL else {
return nil
}
let path = url.path!.stringByReplacingOccurrencesOfString(baseURL.path!+"/", withString: "")
return NSString(string: path)
}
}
func ICantBelieveItsNotFoundation_enumeratorAtPath(path: String) -> ICantBelieveItsNotNSDirectoryEnumerator? {
return ICantBelieveItsNotNSDirectoryEnumerator(path: path)
}
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