[v2] Put mac specific calls behind build tag

This commit is contained in:
Lea Anthony
2021-07-04 09:35:45 +10:00
parent 7661082d58
commit b69f1e6c43
4 changed files with 27 additions and 15 deletions
+2 -15
View File
@@ -1,12 +1,10 @@
package system
import (
"os/exec"
"strings"
"syscall"
"github.com/wailsapp/wails/v2/internal/system/operatingsystem"
"github.com/wailsapp/wails/v2/internal/system/packagemanager"
"os/exec"
"strings"
)
// Info holds information about the current operating system,
@@ -107,14 +105,3 @@ func checkDocker() *packagemanager.Dependancy {
External: false,
}
}
// IsAppleSilicon returns true if the app is running on Apple Silicon
// Credit: https://www.yellowduck.be/posts/detecting-apple-silicon-via-go/
func IsAppleSilicon() bool {
r, err := syscall.Sysctl("sysctl.proc_translated")
if err != nil {
return false
}
return r == "\x00\x00\x00" || r == "\x01\x00\x00"
}
+11
View File
@@ -44,3 +44,14 @@ func (i *Info) discover() error {
i.Dependencies = append(i.Dependencies, checkUPX())
return nil
}
// IsAppleSilicon returns true if the app is running on Apple Silicon
// Credit: https://www.yellowduck.be/posts/detecting-apple-silicon-via-go/
func IsAppleSilicon() bool {
r, err := syscall.Sysctl("sysctl.proc_translated")
if err != nil {
return false
}
return r == "\x00\x00\x00" || r == "\x01\x00\x00"
}
+7
View File
@@ -27,3 +27,10 @@ func (i *Info) discover() error {
return nil
}
// IsAppleSilicon returns true if the app is running on Apple Silicon
// Credit: https://www.yellowduck.be/posts/detecting-apple-silicon-via-go/
// NOTE: Not applicable to linux
func IsAppleSilicon() bool {
return false
}
+7
View File
@@ -43,3 +43,10 @@ func (i *Info) discover() error {
return nil
}
// IsAppleSilicon returns true if the app is running on Apple Silicon
// Credit: https://www.yellowduck.be/posts/detecting-apple-silicon-via-go/
// NOTE: Not applicable to windows
func IsAppleSilicon() bool {
return false
}