blob: f45a3fb54f4065aadde44c604b4cfca08d740ad3 [file] [log] [blame]
import Foundation
let storage = HTTPCookieStorage.shared
let simpleCookie = HTTPCookie(properties: [
.name: "TestCookie",
.value: "Test @#$%^$&*99",
.path: "/",
.domain: "example.com",
])!
let rawValue = getenv("XDG_CONFIG_HOME")
let xdg_config_home = String(utf8String: rawValue!)
storage.setCookie(simpleCookie)
let fm = FileManager.default
let destPath = xdg_config_home! + "/.cookies.shared"
var isDir = false
let exists = fm.fileExists(atPath: destPath, isDirectory: &isDir)
if (!exists) {
exit(-1)
}