//go:build darwin package paths import ( "os" "path/filepath" ) // IPCNetwork returns the transport network for GUI <-> daemon IPC. func IPCNetwork() string { return "unix" } // IPCAddress returns the listen/dial address for GUI <-> daemon IPC. func IPCAddress() string { return "/tmp/lmvpn.sock" } // GUILockNetwork returns the transport for the GUI single-instance lock. func GUILockNetwork() string { return "unix" } // GUILockAddress returns the address for the GUI single-instance lock. func GUILockAddress() string { return Paths.Data + "/gui.sock" } func init() { home, _ := os.UserHomeDir() recomputePaths(home) } // recomputePaths sets Paths based on the given home directory. // On macOS the layout is: // // /Library/Application Support// data // /Library/Caches// cache // /Library/Logs// logs func recomputePaths(home string) { lib := filepath.Join(home, "Library") Paths = Dirs{ Data: filepath.Join(lib, "Application Support", BundleID), Cache: filepath.Join(lib, "Caches", BundleID), Log: filepath.Join(lib, "Logs", BundleID), } }