Skip to content

Commit d353232

Browse files
author
Itai Ferber
committed
Fix failing user defaults case due to merge conflict
1 parent 25dcc03 commit d353232

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

Foundation/NSUserDefaults.swift

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,20 +212,14 @@ open class UserDefaults: NSObject {
212212
//FIXME: CFURLIsFileReferenceURL is limited to OS X/iOS
213213
#if os(OSX) || os(iOS)
214214
//FIXME: no SwiftFoundation version of CFURLIsFileReferenceURL at time of writing!
215-
if !CFURLIsFileReferenceURL(url._cfObject) {
216-
//FIXME: stringByAbbreviatingWithTildeInPath isn't implemented in SwiftFoundation
217-
//TODO: use stringByAbbreviatingWithTildeInPath when it is
218-
let urlPath = url.path
219-
220-
set(urlPath._nsObject, forKey: defaultName)
215+
if CFURLIsFileReferenceURL(url._cfObject) {
216+
let data = NSKeyedArchiver.archivedData(withRootObject: url._nsObject)
217+
set(data._nsObject, forKey: defaultName)
218+
return
221219
}
222-
#else
223-
//FIXME: stringByAbbreviatingWithTildeInPath isn't implemented in SwiftFoundation
224-
//TODO: use stringByAbbreviatingWithTildeInPath when it is
225-
setObject(url.path._nsObject, forKey: defaultName)
226220
#endif
227-
let data = NSKeyedArchiver.archivedData(withRootObject: url._nsObject)
228-
set(data._nsObject, forKey: defaultName)
221+
222+
set(url.path._nsObject, forKey: defaultName)
229223
} else {
230224
set(nil, forKey: defaultName)
231225
}

0 commit comments

Comments
 (0)