@@ -17,27 +17,28 @@ class XDGCheck {
17
17
18
18
static func run( ) -> Never {
19
19
let storage = HTTPCookieStorage . shared
20
- let properties = [
21
- HTTPCookiePropertyKey . name: " TestCookie " ,
22
- HTTPCookiePropertyKey . value: " Test @#$%^$&*99 " ,
23
- HTTPCookiePropertyKey . path: " / " ,
24
- HTTPCookiePropertyKey . domain: " example.com " ,
25
- ]
20
+ let properties : [ HTTPCookiePropertyKey : String ] = [
21
+ . name: " TestCookie " ,
22
+ . value: " Test @#$%^$&*99 " ,
23
+ . path: " / " ,
24
+ . domain: " example.com " ,
25
+ ]
26
26
let simpleCookie = HTTPCookie ( properties: properties)
27
27
guard simpleCookie != nil else {
28
28
exit ( HelperCheckStatus . cookieStorageNil. rawValue)
29
29
}
30
- let rawValue = getenv ( " XDG_CONFIG_HOME " )
30
+ let rawValue = getenv ( " XDG_DATA_HOME " )
31
31
guard rawValue != nil else {
32
32
exit ( HelperCheckStatus . fail. rawValue)
33
33
}
34
- let xdg_config_home = String ( utf8String: rawValue!)
34
+ let xdg_data_home = String ( utf8String: rawValue!)
35
35
storage. setCookie ( simpleCookie!)
36
36
let fm = FileManager . default
37
- let destPath = xdg_config_home ! + " /.cookies.shared "
37
+ let destPath = xdg_data_home ! + " /xdgTestHelper /.cookies.shared"
38
38
var isDir = false
39
39
let exists = fm. fileExists ( atPath: destPath, isDirectory: & isDir)
40
40
if ( !exists) {
41
+ print ( " Expected cookie path: " , destPath)
41
42
exit ( HelperCheckStatus . cookieStorePathWrong. rawValue)
42
43
}
43
44
exit ( HelperCheckStatus . ok. rawValue)
0 commit comments