Skip to content

Commit 0bf5123

Browse files
committed
Foundation: change HTTPCookieStorage to use FileManager
Change the implementation of `HTTPCookieStorage` to use `FileManager.default.url(for:in:)` instead of the internal _CFXDGCreateDataHomePath` method. Now that `HTTPCookieStorage` is moved off to its own library (FoundationNetworking), it no longer has access to the internal function. Use the URL query to get the path to the storage location.
1 parent 44f8738 commit 0bf5123

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Foundation/HTTPCookieStorage.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ open class HTTPCookieStorage: NSObject {
8080
if let range = bundleName.range(of: ".", options: .backwards, range: nil, locale: nil) {
8181
bundleName = String(bundleName[..<range.lowerBound])
8282
}
83-
let cookieFolderPath = (((_CFXDGCreateDataHomePath() as! AnyObject) as! NSString) as String) + "/" + bundleName
83+
let cookieFolderPath = URL(fileURLWithPath: bundleName, relativeTo: FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)[0]).path
8484
cookieFilePath = filePath(path: cookieFolderPath, fileName: "/.cookies." + cookieStorageName, bundleName: bundleName)
8585
loadPersistedCookies()
8686
}

0 commit comments

Comments
 (0)