fyne metadata sucks so jst custom stuff
This commit is contained in:
@@ -95,7 +95,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build for linux
|
- name: Build for linux
|
||||||
run: |
|
run: |
|
||||||
fyne build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}
|
fyne build --os=${GOOS} --metadata BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}
|
||||||
env:
|
env:
|
||||||
VERSION: ${{github.ref_name}}
|
VERSION: ${{github.ref_name}}
|
||||||
BUILD: ${{github.run_number}}
|
BUILD: ${{github.run_number}}
|
||||||
@@ -107,7 +107,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build for windows
|
- name: Build for windows
|
||||||
run: |
|
run: |
|
||||||
fyne build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}.exe
|
fyne build --os=${GOOS} --metadata BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}.exe
|
||||||
env:
|
env:
|
||||||
VERSION: ${{github.ref_name}}
|
VERSION: ${{github.ref_name}}
|
||||||
BUILD: ${{github.run_number}}
|
BUILD: ${{github.run_number}}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build for linux
|
- name: Build for linux
|
||||||
run: |
|
run: |
|
||||||
fyne build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}
|
fyne build --os=${GOOS} --metadata BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}
|
||||||
ls bin
|
ls bin
|
||||||
env:
|
env:
|
||||||
VERSION: ${{github.ref_name}}
|
VERSION: ${{github.ref_name}}
|
||||||
@@ -103,7 +103,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build for windows
|
- name: Build for windows
|
||||||
run: |
|
run: |
|
||||||
fyne build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}.exe
|
fyne build --os=${GOOS} --metadata BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}.exe
|
||||||
ls bin
|
ls bin
|
||||||
env:
|
env:
|
||||||
VERSION: ${{github.ref_name}}
|
VERSION: ${{github.ref_name}}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build for linux
|
- name: Build for linux
|
||||||
run: |
|
run: |
|
||||||
fyne build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}
|
fyne build --os=${GOOS} --metadata BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}
|
||||||
env:
|
env:
|
||||||
VERSION: ${{github.ref_name}}
|
VERSION: ${{github.ref_name}}
|
||||||
BUILD: ${{github.run_number}}
|
BUILD: ${{github.run_number}}
|
||||||
@@ -99,7 +99,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build for windows
|
- name: Build for windows
|
||||||
run: |
|
run: |
|
||||||
fyne build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}.exe
|
fyne build --os=${GOOS} --metadata BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}.exe
|
||||||
env:
|
env:
|
||||||
VERSION: ${{github.ref_name}}
|
VERSION: ${{github.ref_name}}
|
||||||
BUILD: ${{github.run_number}}
|
BUILD: ${{github.run_number}}
|
||||||
|
|||||||
28
main.go
28
main.go
@@ -4,9 +4,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime/debug"
|
||||||
"s1d3sw1ped/swipedmodswitcher/admin"
|
"s1d3sw1ped/swipedmodswitcher/admin"
|
||||||
"slices"
|
"slices"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
@@ -72,7 +72,31 @@ func main() {
|
|||||||
cfg = loadConfig()
|
cfg = loadConfig()
|
||||||
|
|
||||||
ap := app.New()
|
ap := app.New()
|
||||||
wp := ap.NewWindow(ap.Metadata().Name + " v" + ap.Metadata().Version + "." + strconv.Itoa(ap.Metadata().Build))
|
|
||||||
|
commithash := func() string {
|
||||||
|
if info, ok := debug.ReadBuildInfo(); ok {
|
||||||
|
for _, setting := range info.Settings {
|
||||||
|
if setting.Key == "vcs.revision" {
|
||||||
|
return setting.Value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}()
|
||||||
|
|
||||||
|
buildversion := ap.Metadata().Custom["BuildVersion"]
|
||||||
|
if buildversion == "" {
|
||||||
|
buildversion = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
buildnumber := ap.Metadata().Custom["BuildNumber"]
|
||||||
|
if buildnumber == "" {
|
||||||
|
buildnumber = "commit " + commithash
|
||||||
|
} else {
|
||||||
|
buildnumber = "build " + buildnumber
|
||||||
|
}
|
||||||
|
|
||||||
|
wp := ap.NewWindow(ap.Metadata().Name + " " + buildversion + " " + buildnumber)
|
||||||
wp.Resize(fyne.NewSize(600, 1))
|
wp.Resize(fyne.NewSize(600, 1))
|
||||||
wp.CenterOnScreen()
|
wp.CenterOnScreen()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user