Compare commits
3 Commits
be35430727
...
8469610328
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8469610328 | ||
| 9703682b4a | |||
| e281fbafdb |
@@ -90,8 +90,10 @@ jobs:
|
|||||||
|
|
||||||
- name: Build for linux
|
- name: Build for linux
|
||||||
run: |
|
run: |
|
||||||
fyne package --appBuild=${BUILD} --exe bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}${EXE} main.go
|
fyne package --os ${{GOOS}} --release --appVersion=${VERSION#v} --appBuild=${BUILD} --exe bin/sw1ped-mod-switcher-${VERSION#v}.${BUILD}-linux-amd64 main.go
|
||||||
|
mv *.tar.xz bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-linux-amd64.tar.xz
|
||||||
env:
|
env:
|
||||||
|
VERSION: ${{github.ref_name}}
|
||||||
BUILD: ${{github.run_number}}
|
BUILD: ${{github.run_number}}
|
||||||
GOOS: linux
|
GOOS: linux
|
||||||
GOARCH: amd64
|
GOARCH: amd64
|
||||||
@@ -101,12 +103,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Build for windows
|
- name: Build for windows
|
||||||
run: |
|
run: |
|
||||||
fyne package --appBuild=${BUILD} --exe bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}${EXE} main.go
|
fyne package --os ${{GOOS}} --release --appVersion=${VERSION#v} --appBuild=${BUILD} --exe bin/sw1ped-mod-switcher-${VERSION#v}.${BUILD}-windows-amd64.exe main.go
|
||||||
env:
|
env:
|
||||||
|
VERSION: ${{github.ref_name}}
|
||||||
BUILD: ${{github.run_number}}
|
BUILD: ${{github.run_number}}
|
||||||
GOOS: windows
|
GOOS: windows
|
||||||
GOARCH: amd64
|
GOARCH: amd64
|
||||||
EXE: .exe
|
EXE: ".exe"
|
||||||
CGO_ENABLED: 1
|
CGO_ENABLED: 1
|
||||||
CC: x86_64-w64-mingw32-gcc
|
CC: x86_64-w64-mingw32-gcc
|
||||||
|
|
||||||
|
|||||||
@@ -89,15 +89,29 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
go mod tidy
|
go mod tidy
|
||||||
|
|
||||||
- name: Build
|
- name: Build for linux
|
||||||
run: |
|
run: |
|
||||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 CC=gcc fyne package -os=linux -appBuild=${BUILD} -exe bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-linux-amd64 main.go
|
fyne build --os=${{GOOS}} --metadata Version=${{VERSION}} --metadata Build=${{BUILD}} -o bin/sw1ped-mod-switcher-${{VERSION#v}}.${{BUILD}}-${{GOOS}}-${{GOARCH}} main.go
|
||||||
cp *.tar.xz bin/
|
ls bin
|
||||||
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc fyne package -os=windows -appBuild=${BUILD} -exe bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-windows-amd64.exe main.go
|
|
||||||
ls
|
|
||||||
env:
|
env:
|
||||||
VERSION: ${{github.ref_name}}
|
VERSION: ${{github.ref_name}}
|
||||||
BUILD: ${{github.run_number}}
|
BUILD: ${{github.run_number}}
|
||||||
|
GOOS: linux
|
||||||
|
GOARCH: amd64
|
||||||
|
CGO_ENABLED: 1
|
||||||
|
CC: gcc
|
||||||
|
|
||||||
|
- name: Build for windows
|
||||||
|
run: |
|
||||||
|
fyne build --os=${{GOOS}} --metadata Version=${{VERSION}} --metadata Build=${{BUILD}} -o bin/sw1ped-mod-switcher-${{VERSION#v}}.${{BUILD}}-${{GOOS}}-${{GOARCH}}.exe main.go
|
||||||
|
ls bin
|
||||||
|
env:
|
||||||
|
VERSION: ${{github.ref_name}}
|
||||||
|
BUILD: ${{github.run_number}}
|
||||||
|
GOOS: windows
|
||||||
|
GOARCH: amd64
|
||||||
|
CGO_ENABLED: 1
|
||||||
|
CC: x86_64-w64-mingw32-gcc
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
|
|||||||
@@ -87,7 +87,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Build for linux
|
- name: Build for linux
|
||||||
run: |
|
run: |
|
||||||
fyne package --os ${{GOOS}} --release --appVersion=${VERSION#v} --appBuild=${BUILD} --exe bin/sw1ped-mod-switcher-${VERSION#v}.${BUILD}-linux-amd64 main.go
|
fyne package --release --appVersion=${VERSION#v} --appBuild=${BUILD} --exe bin/sw1ped-mod-switcher-${VERSION#v}.${BUILD}-linux-amd64 main.go
|
||||||
|
mv *.tar.xz bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-linux-amd64.tar.xz
|
||||||
env:
|
env:
|
||||||
VERSION: ${{github.ref_name}}
|
VERSION: ${{github.ref_name}}
|
||||||
BUILD: ${{github.run_number}}
|
BUILD: ${{github.run_number}}
|
||||||
@@ -97,10 +98,9 @@ jobs:
|
|||||||
CGO_ENABLED: 1
|
CGO_ENABLED: 1
|
||||||
CC: gcc
|
CC: gcc
|
||||||
|
|
||||||
|
|
||||||
- name: Build for windows
|
- name: Build for windows
|
||||||
run: |
|
run: |
|
||||||
fyne package --os ${{GOOS}} --release --appVersion=${VERSION#v} --appBuild=${BUILD} --exe bin/sw1ped-mod-switcher-${VERSION#v}.${BUILD}-windows-amd64.exe main.go
|
fyne package --release --appVersion=${VERSION#v} --appBuild=${BUILD} --exe bin/sw1ped-mod-switcher-${VERSION#v}.${BUILD}-windows-amd64.exe main.go
|
||||||
env:
|
env:
|
||||||
VERSION: ${{github.ref_name}}
|
VERSION: ${{github.ref_name}}
|
||||||
BUILD: ${{github.run_number}}
|
BUILD: ${{github.run_number}}
|
||||||
@@ -110,7 +110,6 @@ jobs:
|
|||||||
CGO_ENABLED: 1
|
CGO_ENABLED: 1
|
||||||
CC: x86_64-w64-mingw32-gcc
|
CC: x86_64-w64-mingw32-gcc
|
||||||
|
|
||||||
|
|
||||||
- name: Release binaries
|
- name: Release binaries
|
||||||
uses: https://gitea.com/actions/release-action@main
|
uses: https://gitea.com/actions/release-action@main
|
||||||
with:
|
with:
|
||||||
|
|||||||
6
main.go
6
main.go
@@ -63,10 +63,12 @@ var cfg *Config
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if !admin.Admin() {
|
if !admin.Admin() {
|
||||||
|
fmt.Println("not running as administrator relaunching")
|
||||||
if err := admin.RunSelfElevated(); err != nil {
|
if err := admin.RunSelfElevated(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
return // just incase
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg = loadConfig()
|
cfg = loadConfig()
|
||||||
@@ -138,10 +140,14 @@ func fillGrid(grid *fyne.Container, parent fyne.Window) {
|
|||||||
grid.Hide()
|
grid.Hide()
|
||||||
defer grid.Show()
|
defer grid.Show()
|
||||||
grid.RemoveAll()
|
grid.RemoveAll()
|
||||||
|
if admin.Admin() {
|
||||||
for _, profile := range profiles {
|
for _, profile := range profiles {
|
||||||
profilename := filepath.Base(profile)
|
profilename := filepath.Base(profile)
|
||||||
grid.Add(widget.NewButton(profilename, makeIFunc(profile, archive, parent)))
|
grid.Add(widget.NewButton(profilename, makeIFunc(profile, archive, parent)))
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
grid.Add(widget.NewLabel("not running as administrator"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func scanProfiles(profilesroot string) []string {
|
func scanProfiles(profilesroot string) []string {
|
||||||
|
|||||||
Reference in New Issue
Block a user