mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-23 17:16:29 +00:00
26 lines
700 B
Go
26 lines
700 B
Go
|
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
||
|
|
|
||
|
|
package version
|
||
|
|
|
||
|
|
import (
|
||
|
|
"path/filepath"
|
||
|
|
"strings"
|
||
|
|
)
|
||
|
|
|
||
|
|
// prepExeNameForCmp strips any extension and arch suffix from exe, and
|
||
|
|
// lowercases it.
|
||
|
|
func prepExeNameForCmp(exe, arch string) string {
|
||
|
|
baseNoExt := strings.ToLower(strings.TrimSuffix(filepath.Base(exe), filepath.Ext(exe)))
|
||
|
|
archSuffix := "-" + arch
|
||
|
|
return strings.TrimSuffix(baseNoExt, archSuffix)
|
||
|
|
}
|
||
|
|
|
||
|
|
func checkPreppedExeNameForGUI(preppedExeName string) bool {
|
||
|
|
return preppedExeName == "tailscale-ipn" || preppedExeName == "tailscale-gui"
|
||
|
|
}
|
||
|
|
|
||
|
|
func isGUIExeName(exe, arch string) bool {
|
||
|
|
return checkPreppedExeNameForGUI(prepExeNameForCmp(exe, arch))
|
||
|
|
}
|