Merge branch 'filemanager-default' of https://github.com/jpsim/swift-corelibs-foundation
diff --git a/Foundation/NSData.swift b/Foundation/NSData.swift
index e51c124..8ab86c7 100644
--- a/Foundation/NSData.swift
+++ b/Foundation/NSData.swift
@@ -408,7 +408,7 @@
if fd == -1 {
throw _NSErrorWithErrno(errno, reading: false, path: dirPath)
}
- let pathResult = FileManager.default().string(withFileSystemRepresentation:buf, length: Int(strlen(buf)))
+ let pathResult = FileManager.default.string(withFileSystemRepresentation:buf, length: Int(strlen(buf)))
return (fd, pathResult)
}
@@ -472,7 +472,7 @@
} catch let err {
if let auxFilePath = auxFilePath {
do {
- try FileManager.default().removeItem(atPath: auxFilePath)
+ try FileManager.default.removeItem(atPath: auxFilePath)
} catch _ {}
}
throw err
@@ -482,7 +482,7 @@
if let auxFilePath = auxFilePath {
if rename(auxFilePath, path) != 0 {
do {
- try FileManager.default().removeItem(atPath: auxFilePath)
+ try FileManager.default.removeItem(atPath: auxFilePath)
} catch _ {}
throw _NSErrorWithErrno(errno, reading: false, path: path)
}
diff --git a/Foundation/NSFileManager.swift b/Foundation/NSFileManager.swift
index bc3e58a..32dfde5 100644
--- a/Foundation/NSFileManager.swift
+++ b/Foundation/NSFileManager.swift
@@ -70,10 +70,7 @@
/* Returns the default singleton instance.
*/
- internal static let defaultInstance = FileManager()
- open class func `default`() -> FileManager {
- return defaultInstance
- }
+ public static let `default` = FileManager()
/* Returns an NSArray of NSURLs locating the mounted volumes available on the computer. The property keys that can be requested are available in NSURL.
*/
@@ -461,7 +458,7 @@
return
} else if errno == ENOTEMPTY {
- let fsRep = FileManager.default().fileSystemRepresentation(withPath: path)
+ let fsRep = FileManager.default.fileSystemRepresentation(withPath: path)
let ps = UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>.allocate(capacity: 2)
ps.initialize(to: UnsafeMutablePointer(mutating: fsRep))
ps.advanced(by: 1).initialize(to: nil)
@@ -733,7 +730,7 @@
return nil
}
- guard let destination = try? FileManager.default().destinationOfSymbolicLink(atPath: path) else {
+ guard let destination = try? FileManager.default.destinationOfSymbolicLink(atPath: path) else {
return nil
}
@@ -874,7 +871,7 @@
init?(path: String) {
let url = URL(fileURLWithPath: path)
self.baseURL = url
- guard let ie = FileManager.default().enumerator(at: url, includingPropertiesForKeys: nil, options: [], errorHandler: nil) else {
+ guard let ie = FileManager.default.enumerator(at: url, includingPropertiesForKeys: nil, options: [], errorHandler: nil) else {
return nil
}
self.innerEnumerator = ie
@@ -906,8 +903,8 @@
_errorHandler = errorHandler
if let path = _url.path {
- if FileManager.default().fileExists(atPath: path) {
- let fsRep = FileManager.default().fileSystemRepresentation(withPath: path)
+ if FileManager.default.fileExists(atPath: path) {
+ let fsRep = FileManager.default.fileSystemRepresentation(withPath: path)
let ps = UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>.allocate(capacity: 2)
ps.initialize(to: UnsafeMutablePointer(mutating: fsRep))
ps.advanced(by: 1).initialize(to: nil)
diff --git a/Foundation/NSKeyedArchiver.swift b/Foundation/NSKeyedArchiver.swift
index 3d7dcf2..725b557 100644
--- a/Foundation/NSKeyedArchiver.swift
+++ b/Foundation/NSKeyedArchiver.swift
@@ -148,7 +148,7 @@
if finishedEncoding {
try _NSCleanupTemporaryFile(auxFilePath, path)
} else {
- try FileManager.default().removeItem(atPath: auxFilePath)
+ try FileManager.default.removeItem(atPath: auxFilePath)
}
} catch _ {
}
diff --git a/Foundation/NSPathUtilities.swift b/Foundation/NSPathUtilities.swift
index 07891d7..d39f30f 100644
--- a/Foundation/NSPathUtilities.swift
+++ b/Foundation/NSPathUtilities.swift
@@ -146,7 +146,7 @@
}
let temp = _stringByRemovingPrefix(prefix)
- if FileManager.default().fileExists(atPath: temp) {
+ if FileManager.default.fileExists(atPath: temp) {
return temp
}
@@ -347,7 +347,7 @@
default:
resolvedPath = resolvedPath.bridge().stringByAppendingPathComponent(component)
- if let destination = FileManager.default()._tryToResolveTrailingSymlinkInPath(resolvedPath) {
+ if let destination = FileManager.default._tryToResolveTrailingSymlinkInPath(resolvedPath) {
resolvedPath = destination
}
}
@@ -427,7 +427,7 @@
}
var isDirectory = false
- let exists = FileManager.default().fileExists(atPath: path, isDirectory: &isDirectory)
+ let exists = FileManager.default.fileExists(atPath: path, isDirectory: &isDirectory)
return exists && isDirectory
}
@@ -436,7 +436,7 @@
internal func _getNamesAtURL(_ filePathURL: URL, prependWith: String, namePredicate: _FileNamePredicate, typePredicate: _FileNamePredicate) -> [String] {
var result: [String] = []
- if let enumerator = FileManager.default().enumerator(at: filePathURL, includingPropertiesForKeys: nil, options: .skipsSubdirectoryDescendants, errorHandler: nil) {
+ if let enumerator = FileManager.default.enumerator(at: filePathURL, includingPropertiesForKeys: nil, options: .skipsSubdirectoryDescendants, errorHandler: nil) {
for item in enumerator.lazy.map({ $0 as! URL }) {
let itemName = item.lastPathComponent
@@ -618,14 +618,14 @@
if fd == -1 {
throw _NSErrorWithErrno(errno, reading: false, path: filePath)
}
- let pathResult = FileManager.default().string(withFileSystemRepresentation: buf, length: Int(strlen(buf)))
+ let pathResult = FileManager.default.string(withFileSystemRepresentation: buf, length: Int(strlen(buf)))
return (fd, pathResult)
}
internal func _NSCleanupTemporaryFile(_ auxFilePath: String, _ filePath: String) throws {
if rename(auxFilePath, filePath) != 0 {
do {
- try FileManager.default().removeItem(atPath: auxFilePath)
+ try FileManager.default.removeItem(atPath: auxFilePath)
} catch _ {
}
throw _NSErrorWithErrno(errno, reading: false, path: filePath)
diff --git a/Foundation/NSTask.swift b/Foundation/NSTask.swift
index ecb1f4b..fb0276d 100644
--- a/Foundation/NSTask.swift
+++ b/Foundation/NSTask.swift
@@ -152,7 +152,7 @@
open var arguments: [String]?
open var environment: [String : String]? // if not set, use current
- open var currentDirectoryPath: String = FileManager.defaultInstance.currentDirectoryPath
+ open var currentDirectoryPath: String = FileManager.default.currentDirectoryPath
// standard I/O channels; could be either an NSFileHandle or an NSPipe
open var standardInput: AnyObject? {
diff --git a/Foundation/NSURL.swift b/Foundation/NSURL.swift
index 66abd5b..b2ecf12 100644
--- a/Foundation/NSURL.swift
+++ b/Foundation/NSURL.swift
@@ -267,7 +267,7 @@
} else {
absolutePath = path
}
- let _ = FileManager.default().fileExists(atPath: absolutePath, isDirectory: &isDir)
+ let _ = FileManager.default.fileExists(atPath: absolutePath, isDirectory: &isDir)
} catch {
// ignored
}
@@ -287,7 +287,7 @@
if thePath.hasSuffix("/") {
isDir = true
} else {
- let _ = FileManager.default().fileExists(atPath: path, isDirectory: &isDir)
+ let _ = FileManager.default.fileExists(atPath: path, isDirectory: &isDir)
}
self.init(fileURLWithPath: thePath, isDirectory: isDir, relativeTo: nil)
@@ -697,7 +697,7 @@
if let urlWithoutDirectory = result,
let path = urlWithoutDirectory.path {
var isDir : Bool = false
- if FileManager.default().fileExists(atPath: path, isDirectory: &isDir) && isDir {
+ if FileManager.default.fileExists(atPath: path, isDirectory: &isDir) && isDir {
result = self.appendingPathComponent(pathComponent, isDirectory: true)
}
}
@@ -747,7 +747,7 @@
if selfPath.hasPrefix("/") {
absolutePath = selfPath
} else {
- let workingDir = FileManager.default().currentDirectoryPath
+ let workingDir = FileManager.default.currentDirectoryPath
absolutePath = workingDir.bridge().stringByAppendingPathComponent(selfPath)
}
@@ -769,7 +769,7 @@
default:
resolvedPath = resolvedPath.bridge().stringByAppendingPathComponent(component)
- if let destination = FileManager.default()._tryToResolveTrailingSymlinkInPath(resolvedPath) {
+ if let destination = FileManager.default._tryToResolveTrailingSymlinkInPath(resolvedPath) {
resolvedPath = destination
}
}
@@ -777,7 +777,7 @@
// It might be a responsibility of NSURL(fileURLWithPath:). Check it.
var isExistingDirectory = false
- let _ = FileManager.default().fileExists(atPath: resolvedPath, isDirectory: &isExistingDirectory)
+ let _ = FileManager.default.fileExists(atPath: resolvedPath, isDirectory: &isExistingDirectory)
if excludeSystemDirs {
resolvedPath = resolvedPath._tryToRemovePathPrefix("/private") ?? resolvedPath
diff --git a/TestFoundation/TestNSBundle.swift b/TestFoundation/TestNSBundle.swift
index 5460a47..343a443 100644
--- a/TestFoundation/TestNSBundle.swift
+++ b/TestFoundation/TestNSBundle.swift
@@ -68,7 +68,7 @@
let testPlist = bundle.urlForResource("Test", withExtension: "plist")
XCTAssertNotNil(testPlist)
XCTAssertEqual("Test.plist", testPlist!.lastPathComponent)
- XCTAssert(FileManager.default().fileExists(atPath: testPlist!.path!))
+ XCTAssert(FileManager.default.fileExists(atPath: testPlist!.path!))
// aliases, paths
XCTAssertEqual(testPlist!.path, bundle.urlForResource("Test", withExtension: "plist", subdirectory: nil)!.path)
@@ -111,20 +111,20 @@
let tempDir = "/tmp/TestFoundation_Playground_" + NSUUID().uuidString + "/"
do {
- try FileManager.default().createDirectory(atPath: tempDir, withIntermediateDirectories: false, attributes: nil)
+ try FileManager.default.createDirectory(atPath: tempDir, withIntermediateDirectories: false, attributes: nil)
// Make a flat bundle in the playground
let bundlePath = tempDir + _bundleName
- try FileManager.default().createDirectory(atPath: bundlePath, withIntermediateDirectories: false, attributes: nil)
+ try FileManager.default.createDirectory(atPath: bundlePath, withIntermediateDirectories: false, attributes: nil)
// Put some resources in the bundle
for n in _bundleResourceNames {
- let _ = FileManager.default().createFile(atPath: bundlePath + "/" + n, contents: nil, attributes: nil)
+ let _ = FileManager.default.createFile(atPath: bundlePath + "/" + n, contents: nil, attributes: nil)
}
// Add a resource into a subdirectory
let subDirPath = bundlePath + "/" + _subDirectory
- try FileManager.default().createDirectory(atPath: subDirPath, withIntermediateDirectories: false, attributes: nil)
- let _ = FileManager.default().createFile(atPath: subDirPath + "/" + _main + "." + _type, contents: nil, attributes: nil)
+ try FileManager.default.createDirectory(atPath: subDirPath, withIntermediateDirectories: false, attributes: nil)
+ let _ = FileManager.default.createFile(atPath: subDirPath + "/" + _main + "." + _type, contents: nil, attributes: nil)
} catch _ {
return nil
}
@@ -135,7 +135,7 @@
private func _cleanupPlayground(_ location: String) {
do {
- try FileManager.default().removeItem(atPath: location)
+ try FileManager.default.removeItem(atPath: location)
} catch _ {
// Oh well
}
diff --git a/TestFoundation/TestNSData.swift b/TestFoundation/TestNSData.swift
index b1ef9d6..8d7490c 100644
--- a/TestFoundation/TestNSData.swift
+++ b/TestFoundation/TestNSData.swift
@@ -49,7 +49,7 @@
let savePath = URL(fileURLWithPath: "/var/tmp/Test.plist")
do {
try saveData.write(to: savePath, options: .dataWritingAtomic)
- let fileManager = FileManager.default()
+ let fileManager = FileManager.default
XCTAssertTrue(fileManager.fileExists(atPath: savePath.path!))
try! fileManager.removeItem(atPath: savePath.path!)
} catch _ {
diff --git a/TestFoundation/TestNSFileManager.swift b/TestFoundation/TestNSFileManager.swift
index a1aa7e1..2d1fbaa 100644
--- a/TestFoundation/TestNSFileManager.swift
+++ b/TestFoundation/TestNSFileManager.swift
@@ -37,7 +37,7 @@
}
func test_createDirectory() {
- let fm = FileManager.default()
+ let fm = FileManager.default
let path = "/tmp/testdir\(NSUUID().uuidString)"
ignoreError { try fm.removeItem(atPath: path) }
@@ -62,7 +62,7 @@
}
func test_createFile() {
- let fm = FileManager.default()
+ let fm = FileManager.default
let path = "/tmp/testfile\(NSUUID().uuidString)"
ignoreError { try fm.removeItem(atPath: path) }
@@ -82,7 +82,7 @@
}
func test_moveFile() {
- let fm = FileManager.default()
+ let fm = FileManager.default
let path = "/tmp/testfile\(NSUUID().uuidString)"
let path2 = "/tmp/testfile2\(NSUUID().uuidString)"
@@ -105,7 +105,7 @@
func test_fileSystemRepresentation() {
let str = "☃"
- let result = FileManager.default().fileSystemRepresentation(withPath: str)
+ let result = FileManager.default.fileSystemRepresentation(withPath: str)
XCTAssertNotNil(result)
XCTAssertEqual(UInt8(bitPattern: result[0]), 0xE2)
XCTAssertEqual(UInt8(bitPattern: result[1]), 0x98)
@@ -113,7 +113,7 @@
}
func test_fileAttributes() {
- let fm = FileManager.default()
+ let fm = FileManager.default
let path = "/tmp/test_fileAttributes\(NSUUID().uuidString)"
ignoreError { try fm.removeItem(atPath: path) }
@@ -162,7 +162,7 @@
func test_setFileAttributes() {
let path = "/tmp/test_setFileAttributes\(NSUUID().uuidString)"
- let fm = FileManager.default()
+ let fm = FileManager.default
ignoreError { try fm.removeItem(atPath: path) }
XCTAssertTrue(fm.createFile(atPath: path, contents: Data(), attributes: nil))
@@ -187,7 +187,7 @@
}
func test_pathEnumerator() {
- let fm = FileManager.default()
+ let fm = FileManager.default
let testDirName = "testdir\(NSUUID().uuidString)"
let basePath = "/tmp/\(testDirName)"
let itemPath = "/tmp/\(testDirName)/item"
@@ -207,7 +207,7 @@
XCTFail()
}
- if let e = FileManager.default().enumerator(atPath: basePath) {
+ if let e = FileManager.default.enumerator(atPath: basePath) {
let foundItems = NSMutableSet()
while let item = e.nextObject() as? NSString {
foundItems.add(item)
@@ -220,7 +220,7 @@
}
func test_directoryEnumerator() {
- let fm = FileManager.default()
+ let fm = FileManager.default
let testDirName = "testdir\(NSUUID().uuidString)"
let path = "/tmp/\(testDirName)"
let itemPath = "/tmp/\(testDirName)/item"
@@ -234,7 +234,7 @@
XCTFail()
}
- if let e = FileManager.default().enumerator(at: URL(fileURLWithPath: path), includingPropertiesForKeys: nil, options: [], errorHandler: nil) {
+ if let e = FileManager.default.enumerator(at: URL(fileURLWithPath: path), includingPropertiesForKeys: nil, options: [], errorHandler: nil) {
var foundItems = [String:Int]()
while let item = e.nextObject() as? NSURL {
if let p = item.path {
@@ -255,7 +255,7 @@
XCTFail()
}
- if let e = FileManager.default().enumerator(at: URL(fileURLWithPath: path), includingPropertiesForKeys: nil, options: [], errorHandler: nil) {
+ if let e = FileManager.default.enumerator(at: URL(fileURLWithPath: path), includingPropertiesForKeys: nil, options: [], errorHandler: nil) {
var foundItems = [String:Int]()
while let item = e.nextObject() as? NSURL {
if let p = item.path {
@@ -269,7 +269,7 @@
XCTFail()
}
- if let e = FileManager.default().enumerator(at: URL(fileURLWithPath: path), includingPropertiesForKeys: nil, options: [.skipsSubdirectoryDescendants], errorHandler: nil) {
+ if let e = FileManager.default.enumerator(at: URL(fileURLWithPath: path), includingPropertiesForKeys: nil, options: [.skipsSubdirectoryDescendants], errorHandler: nil) {
var foundItems = [String:Int]()
while let item = e.nextObject() as? NSURL {
if let p = item.path {
@@ -282,7 +282,7 @@
XCTFail()
}
- if let e = FileManager.default().enumerator(at: URL(fileURLWithPath: path), includingPropertiesForKeys: nil, options: [], errorHandler: nil) {
+ if let e = FileManager.default.enumerator(at: URL(fileURLWithPath: path), includingPropertiesForKeys: nil, options: [], errorHandler: nil) {
var foundItems = [String:Int]()
while let item = e.nextObject() as? NSURL {
if let p = item.path {
@@ -300,7 +300,7 @@
didGetError = true
return true
}
- if let e = FileManager.default().enumerator(at: URL(fileURLWithPath: "/nonexistant-path"), includingPropertiesForKeys: nil, options: [], errorHandler: handler) {
+ if let e = FileManager.default.enumerator(at: URL(fileURLWithPath: "/nonexistant-path"), includingPropertiesForKeys: nil, options: [], errorHandler: handler) {
XCTAssertNil(e.nextObject())
} else {
XCTFail()
@@ -308,7 +308,7 @@
XCTAssertTrue(didGetError)
do {
- let contents = try FileManager.default().contentsOfDirectory(at: URL(fileURLWithPath: path), includingPropertiesForKeys: nil, options: []).map {
+ let contents = try FileManager.default.contentsOfDirectory(at: URL(fileURLWithPath: path), includingPropertiesForKeys: nil, options: []).map {
return $0.path!
}
XCTAssertEqual(contents.count, 2)
@@ -326,7 +326,7 @@
}
func test_contentsOfDirectoryAtPath() {
- let fm = FileManager.default()
+ let fm = FileManager.default
let testDirName = "testdir\(NSUUID().uuidString)"
let path = "/tmp/\(testDirName)"
let itemPath1 = "/tmp/\(testDirName)/item"
@@ -370,7 +370,7 @@
}
func test_subpathsOfDirectoryAtPath() {
- let fm = FileManager.default()
+ let fm = FileManager.default
let path = "/tmp/testdir"
let path2 = "/tmp/testdir/sub"
let itemPath1 = "/tmp/testdir/item"
diff --git a/TestFoundation/TestNSJSONSerialization.swift b/TestFoundation/TestNSJSONSerialization.swift
index 5dbd44f..f0ff813 100644
--- a/TestFoundation/TestNSJSONSerialization.swift
+++ b/TestFoundation/TestNSJSONSerialization.swift
@@ -841,8 +841,8 @@
private func createTestFile(_ path: String,_contents: Data) -> String? {
let tempDir = "/tmp/TestFoundation_Playground_" + NSUUID().uuidString + "/"
do {
- try FileManager.default().createDirectory(atPath: tempDir, withIntermediateDirectories: false, attributes: nil)
- if FileManager.default().createFile(atPath: tempDir + "/" + path, contents: _contents,
+ try FileManager.default.createDirectory(atPath: tempDir, withIntermediateDirectories: false, attributes: nil)
+ if FileManager.default.createFile(atPath: tempDir + "/" + path, contents: _contents,
attributes: nil) {
return tempDir + path
} else {
@@ -855,7 +855,7 @@
private func removeTestFile(_ location: String) {
do {
- try FileManager.default().removeItem(atPath: location)
+ try FileManager.default.removeItem(atPath: location)
} catch _ {
}
diff --git a/TestFoundation/TestNSStream.swift b/TestFoundation/TestNSStream.swift
index 0b96287..cce0e62 100644
--- a/TestFoundation/TestNSStream.swift
+++ b/TestFoundation/TestNSStream.swift
@@ -219,8 +219,8 @@
private func createTestFile(_ path: String, _contents: Data) -> String? {
let tempDir = "/tmp/TestFoundation_Playground_" + NSUUID().uuidString + "/"
do {
- try FileManager.default().createDirectory(atPath: tempDir, withIntermediateDirectories: false, attributes: nil)
- if FileManager.default().createFile(atPath: tempDir + "/" + path, contents: _contents,
+ try FileManager.default.createDirectory(atPath: tempDir, withIntermediateDirectories: false, attributes: nil)
+ if FileManager.default.createFile(atPath: tempDir + "/" + path, contents: _contents,
attributes: nil) {
return tempDir + path
} else {
@@ -233,7 +233,7 @@
private func removeTestFile(_ location: String) {
do {
- try FileManager.default().removeItem(atPath: location)
+ try FileManager.default.removeItem(atPath: location)
} catch _ {
}
diff --git a/TestFoundation/TestNSString.swift b/TestFoundation/TestNSString.swift
index a92b2cc..32c90e9 100644
--- a/TestFoundation/TestNSString.swift
+++ b/TestFoundation/TestNSString.swift
@@ -435,7 +435,7 @@
var outName: NSString?
var matches: [NSString] = []
_ = path.completePathIntoString(&outName, caseSensitive: false, matchesIntoArray: &matches, filterTypes: nil)
- _ = try FileManager.default().contentsOfDirectory(at: URL(string: path.bridge())!, includingPropertiesForKeys: nil, options: [])
+ _ = try FileManager.default.contentsOfDirectory(at: URL(string: path.bridge())!, includingPropertiesForKeys: nil, options: [])
XCTAssert(outName == "/", "If NSString is valid path to directory which has '/' suffix then outName is '/'.")
// This assert fails on CI; https://bugs.swift.org/browse/SR-389
// XCTAssert(matches.count == content.count && matches.count == count, "If NSString is valid path to directory then matches contain all content of directory. expected \(content) but got \(matches)")
@@ -449,7 +449,7 @@
var matches: [NSString] = []
_ = path.completePathIntoString(&outName, caseSensitive: false, matchesIntoArray: &matches, filterTypes: nil)
let urlToTmp = try URL(fileURLWithPath: "/private/tmp/").standardizingPath()
- _ = try FileManager.default().contentsOfDirectory(at: urlToTmp, includingPropertiesForKeys: nil, options: [])
+ _ = try FileManager.default.contentsOfDirectory(at: urlToTmp, includingPropertiesForKeys: nil, options: [])
XCTAssert(outName == "/tmp/", "If path could be completed to existing directory then outName is a string itself plus '/'.")
// This assert fails on CI; https://bugs.swift.org/browse/SR-389
// XCTAssert(matches.count == content.count && matches.count == count, "If NSString is valid path to directory then matches contain all content of directory. expected \(content) but got \(matches)")
diff --git a/TestFoundation/TestNSURL.swift b/TestFoundation/TestNSURL.swift
index 9b6ba91..e3c0925 100644
--- a/TestFoundation/TestNSURL.swift
+++ b/TestFoundation/TestNSURL.swift
@@ -272,7 +272,7 @@
return false
}
- let cwd = FileManager.default().currentDirectoryPath
+ let cwd = FileManager.default.currentDirectoryPath
let cwdURL = URL(fileURLWithPath: cwd, isDirectory: true)
// 1 for path separator
cwdURL.withUnsafeFileSystemRepresentation {
@@ -406,7 +406,7 @@
do {
let url = URL(fileURLWithPath: "~")
let result = try url.resolvingSymlinksInPath().absoluteString
- let expected = "file://" + FileManager.default().currentDirectoryPath + "/~"
+ let expected = "file://" + FileManager.default.currentDirectoryPath + "/~"
XCTAssertEqual(result, expected, "URLByResolvingSymlinksInPath resolves relative paths using current working directory.")
} catch {
XCTFail()
@@ -415,7 +415,7 @@
do {
let url = URL(fileURLWithPath: "anysite.com/search")
let result = try url.resolvingSymlinksInPath().absoluteString
- let expected = "file://" + FileManager.default().currentDirectoryPath + "/anysite.com/search"
+ let expected = "file://" + FileManager.default.currentDirectoryPath + "/anysite.com/search"
XCTAssertEqual(result, expected)
} catch {
XCTFail()
diff --git a/TestFoundation/TestUtils.swift b/TestFoundation/TestUtils.swift
index 0e306fd..0bc9a1a 100644
--- a/TestFoundation/TestUtils.swift
+++ b/TestFoundation/TestUtils.swift
@@ -17,7 +17,7 @@
func ensureFiles(_ fileNames: [String]) -> Bool {
var result = true
- let fm = FileManager.default()
+ let fm = FileManager.default
for name in fileNames {
guard !fm.fileExists(atPath: name) else {
continue