Skip to content

Commit 8c82c36

Browse files
authored
Merge branch 'master' into macos-parity
2 parents 509c054 + 667dde1 commit 8c82c36

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

Foundation/NSHTTPCookieStorage.swift

Lines changed: 3 additions & 3 deletions
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

@@ -65,7 +65,7 @@ open class HTTPCookieStorage: NSObject {
6565
guard !FileManager.default.fileExists(atPath: path) else { return true }
6666

6767
do {
68-
try FileManager.default.createDirectory(atPath: path, withIntermediateDirectories: false, attributes: nil)
68+
try FileManager.default.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil)
6969
return true
7070
} catch {
7171
return false
@@ -77,7 +77,7 @@ open class HTTPCookieStorage: NSObject {
7777
return path + fileName
7878
}
7979
//if we were unable to create the desired directory, create the cookie file in the `pwd`
80-
return fileName
80+
return FileManager.default.currentDirectoryPath + fileName
8181
}
8282

8383
open var cookies: [HTTPCookie]? {

Foundation/Thread.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private func _compiler_crash_fix(_ key: _CFThreadSpecificKey, _ value: AnyObject
2424
internal class NSThreadSpecific<T: NSObject> {
2525
private var key = _CFThreadSpecificKeyCreate()
2626

27-
internal func get(_ generator: (Void) -> T) -> T {
27+
internal func get(_ generator: () -> T) -> T {
2828
if let specific = _CFThreadSpecificGet(key) {
2929
return specific as! T
3030
} else {
@@ -130,7 +130,7 @@ open class Thread : NSObject {
130130
pthread_exit(nil)
131131
}
132132

133-
internal var _main: (Void) -> Void = {}
133+
internal var _main: () -> Void = {}
134134
#if os(OSX) || os(iOS) || CYGWIN
135135
private var _thread: pthread_t? = nil
136136
#elseif os(Linux) || os(Android)

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

TestFoundation/XDGTestHelper.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,3 @@ class XDGCheck {
4343
exit(HelperCheckStatus.ok.rawValue)
4444
}
4545
}
46-

0 commit comments

Comments
 (0)