Merge pull request 'merge master into develop' (#22) from master into develop
Reviewed-on: #22
This commit is contained in:
@@ -90,8 +90,9 @@ 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 build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}
|
||||||
env:
|
env:
|
||||||
|
VERSION: ${{github.ref_name}}
|
||||||
BUILD: ${{github.run_number}}
|
BUILD: ${{github.run_number}}
|
||||||
GOOS: linux
|
GOOS: linux
|
||||||
GOARCH: amd64
|
GOARCH: amd64
|
||||||
@@ -101,12 +102,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 build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}.exe
|
||||||
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
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
name: Lint
|
name: Lint
|
||||||
env:
|
env:
|
||||||
RUNNER_TOOL_CACHE: /toolcache
|
RUNNER_TOOL_CACHE: /toolcache
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -91,25 +91,25 @@ 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 build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}
|
||||||
|
ls bin
|
||||||
env:
|
env:
|
||||||
VERSION: ${{github.ref_name}}
|
VERSION: ${{github.ref_name}}
|
||||||
BUILD: ${{github.run_number}}
|
BUILD: ${{github.run_number}}
|
||||||
GOOS: linux
|
GOOS: linux
|
||||||
GOARCH: amd64
|
GOARCH: amd64
|
||||||
EXE: ""
|
|
||||||
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 build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}.exe
|
||||||
|
ls bin
|
||||||
env:
|
env:
|
||||||
VERSION: ${{github.ref_name}}
|
VERSION: ${{github.ref_name}}
|
||||||
BUILD: ${{github.run_number}}
|
BUILD: ${{github.run_number}}
|
||||||
GOOS: windows
|
GOOS: windows
|
||||||
GOARCH: amd64
|
GOARCH: amd64
|
||||||
EXE: .exe
|
|
||||||
CGO_ENABLED: 1
|
CGO_ENABLED: 1
|
||||||
CC: x86_64-w64-mingw32-gcc
|
CC: x86_64-w64-mingw32-gcc
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ 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 build --os=${GOOS} --metadata Build=${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}}
|
||||||
@@ -97,10 +97,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 build --os=${GOOS} --metadata Build=${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}}
|
||||||
@@ -110,7 +109,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:
|
||||||
|
|||||||
10
FyneApp.toml
10
FyneApp.toml
@@ -1,6 +1,6 @@
|
|||||||
[Details]
|
[Details]
|
||||||
Icon = "icon.png"
|
Icon = "icon.png"
|
||||||
Name = "Swiped Mod Switcher"
|
Name = "Swiped Mod Switcher"
|
||||||
ID = "com.s1d3sw1ped.swipedmodswitcher"
|
ID = "com.s1d3sw1ped.swipedmodswitcher"
|
||||||
Version = "0.0.0"
|
Version = "0.0.0"
|
||||||
Build = 1
|
Build = 2
|
||||||
|
|||||||
14
main.go
14
main.go
@@ -18,6 +18,8 @@ import (
|
|||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var Version = ""
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
ModProfilesDirectory string `yaml:"mod_profiles_dir"`
|
ModProfilesDirectory string `yaml:"mod_profiles_dir"`
|
||||||
GameModsDirectory string `yaml:"game_mods_dir"`
|
GameModsDirectory string `yaml:"game_mods_dir"`
|
||||||
@@ -61,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()
|
||||||
@@ -136,9 +140,13 @@ func fillGrid(grid *fyne.Container, parent fyne.Window) {
|
|||||||
grid.Hide()
|
grid.Hide()
|
||||||
defer grid.Show()
|
defer grid.Show()
|
||||||
grid.RemoveAll()
|
grid.RemoveAll()
|
||||||
for _, profile := range profiles {
|
if admin.Admin() {
|
||||||
profilename := filepath.Base(profile)
|
for _, profile := range profiles {
|
||||||
grid.Add(widget.NewButton(profilename, makeIFunc(profile, archive, parent)))
|
profilename := filepath.Base(profile)
|
||||||
|
grid.Add(widget.NewButton(profilename, makeIFunc(profile, archive, parent)))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
grid.Add(widget.NewLabel("not running as administrator"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user