mirror of
https://github.com/tailscale/tailscale.git
synced 2025-03-23 17:51:05 +00:00
version: add IsSandboxedMacOS func
For when we need to tweak behavior or errors as a function of which of 3 macOS Tailscale variants we're using. (more accessors coming later as needed) Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
8efc7834f2
commit
4512aad889
@ -4,7 +4,11 @@
|
||||
|
||||
package version
|
||||
|
||||
import "runtime"
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// IsMobile reports whether this is a mobile client build.
|
||||
func IsMobile() bool {
|
||||
@ -22,3 +26,14 @@ func OS() string {
|
||||
}
|
||||
return runtime.GOOS
|
||||
}
|
||||
|
||||
// IsSandboxedMacOS reports whether this process is a sandboxed macOS
|
||||
// (GUI) process. It is true for the Mac App Store and macsys (System
|
||||
// Extension) version on macOS, and false for tailscaled-on-macOS.
|
||||
func IsSandboxedMacOS() bool {
|
||||
if runtime.GOOS != "darwin" {
|
||||
return false
|
||||
}
|
||||
exe, _ := os.Executable()
|
||||
return strings.HasSuffix(exe, "/Contents/MacOS/Tailscale")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user