mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
[v2] Target ARM on Apple Silicon, even if CLI is compiled for AMD64
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"github.com/wailsapp/wails/v2/internal/system/operatingsystem"
|
||||
"github.com/wailsapp/wails/v2/internal/system/packagemanager"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/wailsapp/wails/v2/internal/system/operatingsystem"
|
||||
"github.com/wailsapp/wails/v2/internal/system/packagemanager"
|
||||
)
|
||||
|
||||
// Info holds information about the current operating system,
|
||||
@@ -105,3 +107,14 @@ 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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user