Skip to content

Commit b491d22

Browse files
committed
Store cookies in XDG_DATA_HOME
1 parent b18f3a0 commit b491d22

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Foundation/NSHTTPCookieStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ open class HTTPCookieStorage: NSObject {
4747
allCookies = [:]
4848
cookieAcceptPolicy = .always
4949
super.init()
50-
cookieFilePath = filePath(path: _CFXDGCreateConfigHomePath()._swiftObject, fileName: "/.cookies." + cookieStorageName)
50+
cookieFilePath = filePath(path: _CFXDGCreateDataHomePath()._swiftObject, fileName: "/.cookies." + cookieStorageName)
5151
loadPersistedCookies()
5252
}
5353

TestFoundation/TestNSHTTPCookieStorage.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ class TestNSHTTPCookieStorage: XCTestCase {
227227
storage.setCookie(testCookie)
228228
XCTAssertEqual(storage.cookies!.count, 3)
229229
var destPath: String
230-
if let xdg_config_home = getenv("XDG_CONFIG_HOME") {
231-
destPath = String(utf8String: xdg_config_home)! + "/.cookies.shared"
230+
if let xdg_data_home = getenv("XDG_DATA_HOME") {
231+
destPath = String(utf8String: xdg_data_home)! + "/.cookies.shared"
232232
} else {
233-
destPath = NSHomeDirectory() + "/.config/.cookies.shared"
233+
destPath = NSHomeDirectory() + "/.local/share/.cookies.shared"
234234
}
235235
let fm = FileManager.default
236236
var isDir = false

0 commit comments

Comments
 (0)