Skip to content

Commit

Permalink
fix: support for windows arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Sep 14, 2021
1 parent 3ecdffd commit f7de8ae
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/artifacts.yml
Expand Up @@ -20,6 +20,8 @@ jobs:
goarch: arm
- os: windows-latest
goarch: 386
- os: windows-latest
goarch: arm64
runs-on: ${{ matrix.os }}
defaults:
run:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Expand Up @@ -50,6 +50,8 @@ jobs:
goarch: arm
- os: windows-latest
goarch: 386
- os: windows-latest
goarch: arm64
runs-on: ${{ matrix.os }}
defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion src/constants_windows64.go
@@ -1,4 +1,4 @@
//go:build windows && amd64
//go:build windows && !386

package main

Expand Down
11 changes: 0 additions & 11 deletions src/environment.go
Expand Up @@ -17,7 +17,6 @@ import (
"time"

"github.com/distatus/battery"
"github.com/shirou/gopsutil/host"
"github.com/shirou/gopsutil/process"
)

Expand Down Expand Up @@ -263,16 +262,6 @@ func (env *environment) getRuntimeGOOS() string {
return runtime.GOOS
}

func (env *environment) getPlatform() string {
defer env.tracer.trace(time.Now(), "getPlatform")
if runtime.GOOS == windowsPlatform {
return windowsPlatform
}
p, _, _, _ := host.PlatformInformation()

return p
}

func (env *environment) runCommand(command string, args ...string) (string, error) {
defer env.tracer.trace(time.Now(), "runCommand", append([]string{command}, args...)...)
if cmd, ok := env.cmdCache.get(command); ok {
Expand Down
6 changes: 6 additions & 0 deletions src/environment_unix.go
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"time"

"github.com/shirou/gopsutil/host"
terminal "github.com/wayneashleyberry/terminal-dimensions"
)

Expand Down Expand Up @@ -37,3 +38,8 @@ func (env *environment) getTerminalWidth() (int, error) {
width, err := terminal.Width()
return int(width), err
}

func (env *environment) getPlatform() string {
p, _, _, _ := host.PlatformInformation()
return p
}
4 changes: 4 additions & 0 deletions src/environment_windows.go
Expand Up @@ -72,3 +72,7 @@ func (env *environment) getTerminalWidth() (int, error) {
defer env.tracer.trace(time.Now(), "getTerminalWidth")
return 0, errors.New("Unsupported on Windows")
}

func (env *environment) getPlatform() string {
return windowsPlatform
}
6 changes: 5 additions & 1 deletion src/go.mod
@@ -1,4 +1,4 @@
module github.com/jandedobbeleer/oh-my-posh
module oh-my-posh

go 1.17

Expand Down Expand Up @@ -58,3 +58,7 @@ require (
)

replace github.com/distatus/battery v0.10.0 => github.com/JanDeDobbeleer/battery v0.10.0-2

replace github.com/go-ole/go-ole v1.2.5 => github.com/JanDeDobbeleer/go-ole v1.2.5-3

replace github.com/shirou/gopsutil v3.21.8+incompatible => github.com/JanDeDobbeleer/gopsutil v3.21.8-3+incompatible
8 changes: 4 additions & 4 deletions src/go.sum
Expand Up @@ -3,6 +3,10 @@ github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw
github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/JanDeDobbeleer/battery v0.10.0-2 h1:nmFASq8Rmo0sHz6gLT3pXHh7uNABLEgEozKb2tRPgVY=
github.com/JanDeDobbeleer/battery v0.10.0-2/go.mod h1:STnSvFLX//eEpkaN7qWRxCWxrWOcssTDgnG4yqq9BRE=
github.com/JanDeDobbeleer/go-ole v1.2.5-3 h1:z6+1XIZhd2+ylw9yQ4Vrk2xntprmridenT3j5HI5VuM=
github.com/JanDeDobbeleer/go-ole v1.2.5-3/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/JanDeDobbeleer/gopsutil v3.21.8-3+incompatible h1:Y6GIcYLff4J6MSIdCK8cOrre8cJVjRjVGvnnaoTWwnw=
github.com/JanDeDobbeleer/gopsutil v3.21.8-3+incompatible/go.mod h1:7cScMdSKcXHocZHUVqp7KI/2RMf0ZIhl8BGd7Hj3AFQ=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
Expand All @@ -28,8 +32,6 @@ github.com/esimov/stackblur-go v1.0.0 h1:PuXWrQ16VIh6Di+tn3CpKAyzkIIECo9DPGVecrz
github.com/esimov/stackblur-go v1.0.0/go.mod h1:a3zzeKuJKUpCcReHmEsuPaEnq42D2b/bHoCI8UjIuMY=
github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8=
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY=
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
Expand Down Expand Up @@ -97,8 +99,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/shirou/gopsutil v3.21.8+incompatible h1:sh0foI8tMRlCidUJR+KzqWYWxrkuuPIGiO6Vp+KXdCU=
github.com/shirou/gopsutil v3.21.8+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
Expand Down

0 comments on commit f7de8ae

Please sign in to comment.