Documentation
¶
Overview ¶
Package desktopcopy recognises a zn executable that ZenNotes desktop placed and manages itself.
On macOS and Linux desktop runs zn through a shell launcher that exports ZENNOTES_WORKSPACE_SOURCE=app and ZENNOTES_APP_PATH. Windows has no such launcher: desktop puts a real zn.exe in a folder it owns and writes a sidecar file beside it,
zn.desktop.json {"schemaVersion":1,"appPath":"C:\\...\\ZenNotes.exe"}
which tells this copy of zn that it belongs to the app. Development builds of desktop leave appPath out; schemaVersion 1 alone is enough. The check is the same on every platform, so desktop may use it anywhere.
Index ¶
Constants ¶
const FileName = "zn.desktop.json"
FileName is the sidecar's name, next to the executable.
Variables ¶
This section is empty.
Functions ¶
func ApplyEnv ¶
func ApplyEnv() bool
ApplyEnv gives a desktop-managed copy the environment desktop's launcher gives it elsewhere: ZENNOTES_WORKSPACE_SOURCE=app and, when the sidecar names the app, ZENNOTES_APP_PATH, each only when it is unset or empty, as the launcher's `${VAR:=value}` does. It reports whether a sidecar was found.
Types ¶
type Sidecar ¶
type Sidecar struct {
// AppPath is the absolute path to the ZenNotes desktop executable, or ""
// when the sidecar has none (development builds of desktop omit it).
AppPath string
}
Sidecar is the parsed zn.desktop.json.
func Read ¶
Read returns the sidecar beside executable. Any problem (no file, not a regular file, too large, written by someone else, not JSON, an unknown schemaVersion, an appPath that is present but not an absolute path) reports false: a malformed or untrusted sidecar is ignored, never an error, so it cannot stop zn from running.