@@ -37,7 +37,7 @@ class TestNSFileManager : XCTestCase {
3737 }
3838
3939 func test_createDirectory( ) {
40- let fm = FileManager . default ( )
40+ let fm = FileManager . default
4141 let path = " /tmp/testdir \( NSUUID ( ) . uuidString) "
4242
4343 ignoreError { try fm. removeItem ( atPath: path) }
@@ -62,7 +62,7 @@ class TestNSFileManager : XCTestCase {
6262 }
6363
6464 func test_createFile( ) {
65- let fm = FileManager . default ( )
65+ let fm = FileManager . default
6666 let path = " /tmp/testfile \( NSUUID ( ) . uuidString) "
6767
6868 ignoreError { try fm. removeItem ( atPath: path) }
@@ -82,7 +82,7 @@ class TestNSFileManager : XCTestCase {
8282 }
8383
8484 func test_moveFile( ) {
85- let fm = FileManager . default ( )
85+ let fm = FileManager . default
8686 let path = " /tmp/testfile \( NSUUID ( ) . uuidString) "
8787 let path2 = " /tmp/testfile2 \( NSUUID ( ) . uuidString) "
8888
@@ -105,15 +105,15 @@ class TestNSFileManager : XCTestCase {
105105
106106 func test_fileSystemRepresentation( ) {
107107 let str = " ☃ "
108- let result = FileManager . default ( ) . fileSystemRepresentation ( withPath: str)
108+ let result = FileManager . default. fileSystemRepresentation ( withPath: str)
109109 XCTAssertNotNil ( result)
110110 XCTAssertEqual ( UInt8 ( bitPattern: result [ 0 ] ) , 0xE2 )
111111 XCTAssertEqual ( UInt8 ( bitPattern: result [ 1 ] ) , 0x98 )
112112 XCTAssertEqual ( UInt8 ( bitPattern: result [ 2 ] ) , 0x83 )
113113 }
114114
115115 func test_fileAttributes( ) {
116- let fm = FileManager . default ( )
116+ let fm = FileManager . default
117117 let path = " /tmp/test_fileAttributes \( NSUUID ( ) . uuidString) "
118118
119119 ignoreError { try fm. removeItem ( atPath: path) }
@@ -162,7 +162,7 @@ class TestNSFileManager : XCTestCase {
162162
163163 func test_setFileAttributes( ) {
164164 let path = " /tmp/test_setFileAttributes \( NSUUID ( ) . uuidString) "
165- let fm = FileManager . default ( )
165+ let fm = FileManager . default
166166
167167 ignoreError { try fm. removeItem ( atPath: path) }
168168 XCTAssertTrue ( fm. createFile ( atPath: path, contents: Data ( ) , attributes: nil ) )
@@ -187,7 +187,7 @@ class TestNSFileManager : XCTestCase {
187187 }
188188
189189 func test_pathEnumerator( ) {
190- let fm = FileManager . default ( )
190+ let fm = FileManager . default
191191 let testDirName = " testdir \( NSUUID ( ) . uuidString) "
192192 let basePath = " /tmp/ \( testDirName) "
193193 let itemPath = " /tmp/ \( testDirName) /item "
@@ -207,7 +207,7 @@ class TestNSFileManager : XCTestCase {
207207 XCTFail ( )
208208 }
209209
210- if let e = FileManager . default ( ) . enumerator ( atPath: basePath) {
210+ if let e = FileManager . default. enumerator ( atPath: basePath) {
211211 let foundItems = NSMutableSet ( )
212212 while let item = e. nextObject ( ) as? NSString {
213213 foundItems. add ( item)
@@ -220,7 +220,7 @@ class TestNSFileManager : XCTestCase {
220220 }
221221
222222 func test_directoryEnumerator( ) {
223- let fm = FileManager . default ( )
223+ let fm = FileManager . default
224224 let testDirName = " testdir \( NSUUID ( ) . uuidString) "
225225 let path = " /tmp/ \( testDirName) "
226226 let itemPath = " /tmp/ \( testDirName) /item "
@@ -234,7 +234,7 @@ class TestNSFileManager : XCTestCase {
234234 XCTFail ( )
235235 }
236236
237- if let e = FileManager . default ( ) . enumerator ( at: URL ( fileURLWithPath: path) , includingPropertiesForKeys: nil , options: [ ] , errorHandler: nil ) {
237+ if let e = FileManager . default. enumerator ( at: URL ( fileURLWithPath: path) , includingPropertiesForKeys: nil , options: [ ] , errorHandler: nil ) {
238238 var foundItems = [ String: Int] ( )
239239 while let item = e. nextObject ( ) as? NSURL {
240240 if let p = item. path {
@@ -255,7 +255,7 @@ class TestNSFileManager : XCTestCase {
255255 XCTFail ( )
256256 }
257257
258- if let e = FileManager . default ( ) . enumerator ( at: URL ( fileURLWithPath: path) , includingPropertiesForKeys: nil , options: [ ] , errorHandler: nil ) {
258+ if let e = FileManager . default. enumerator ( at: URL ( fileURLWithPath: path) , includingPropertiesForKeys: nil , options: [ ] , errorHandler: nil ) {
259259 var foundItems = [ String: Int] ( )
260260 while let item = e. nextObject ( ) as? NSURL {
261261 if let p = item. path {
@@ -269,7 +269,7 @@ class TestNSFileManager : XCTestCase {
269269 XCTFail ( )
270270 }
271271
272- if let e = FileManager . default ( ) . enumerator ( at: URL ( fileURLWithPath: path) , includingPropertiesForKeys: nil , options: [ . skipsSubdirectoryDescendants] , errorHandler: nil ) {
272+ if let e = FileManager . default. enumerator ( at: URL ( fileURLWithPath: path) , includingPropertiesForKeys: nil , options: [ . skipsSubdirectoryDescendants] , errorHandler: nil ) {
273273 var foundItems = [ String: Int] ( )
274274 while let item = e. nextObject ( ) as? NSURL {
275275 if let p = item. path {
@@ -282,7 +282,7 @@ class TestNSFileManager : XCTestCase {
282282 XCTFail ( )
283283 }
284284
285- if let e = FileManager . default ( ) . enumerator ( at: URL ( fileURLWithPath: path) , includingPropertiesForKeys: nil , options: [ ] , errorHandler: nil ) {
285+ if let e = FileManager . default. enumerator ( at: URL ( fileURLWithPath: path) , includingPropertiesForKeys: nil , options: [ ] , errorHandler: nil ) {
286286 var foundItems = [ String: Int] ( )
287287 while let item = e. nextObject ( ) as? NSURL {
288288 if let p = item. path {
@@ -300,15 +300,15 @@ class TestNSFileManager : XCTestCase {
300300 didGetError = true
301301 return true
302302 }
303- if let e = FileManager . default ( ) . enumerator ( at: URL ( fileURLWithPath: " /nonexistant-path " ) , includingPropertiesForKeys: nil , options: [ ] , errorHandler: handler) {
303+ if let e = FileManager . default. enumerator ( at: URL ( fileURLWithPath: " /nonexistant-path " ) , includingPropertiesForKeys: nil , options: [ ] , errorHandler: handler) {
304304 XCTAssertNil ( e. nextObject ( ) )
305305 } else {
306306 XCTFail ( )
307307 }
308308 XCTAssertTrue ( didGetError)
309309
310310 do {
311- let contents = try FileManager . default ( ) . contentsOfDirectory ( at: URL ( fileURLWithPath: path) , includingPropertiesForKeys: nil , options: [ ] ) . map {
311+ let contents = try FileManager . default. contentsOfDirectory ( at: URL ( fileURLWithPath: path) , includingPropertiesForKeys: nil , options: [ ] ) . map {
312312 return $0. path!
313313 }
314314 XCTAssertEqual ( contents. count, 2 )
@@ -326,7 +326,7 @@ class TestNSFileManager : XCTestCase {
326326 }
327327
328328 func test_contentsOfDirectoryAtPath( ) {
329- let fm = FileManager . default ( )
329+ let fm = FileManager . default
330330 let testDirName = " testdir \( NSUUID ( ) . uuidString) "
331331 let path = " /tmp/ \( testDirName) "
332332 let itemPath1 = " /tmp/ \( testDirName) /item "
@@ -370,7 +370,7 @@ class TestNSFileManager : XCTestCase {
370370 }
371371
372372 func test_subpathsOfDirectoryAtPath( ) {
373- let fm = FileManager . default ( )
373+ let fm = FileManager . default
374374 let path = " /tmp/testdir "
375375 let path2 = " /tmp/testdir/sub "
376376 let itemPath1 = " /tmp/testdir/item "
0 commit comments