22 Commits

Author SHA1 Message Date
06503ce518 fix typo in tag-release
All checks were successful
CI / Build (push) Successful in 1m38s
CI / Test (push) Successful in 2m4s
CI / Lint (push) Successful in 2m7s
CI / Lint (pull_request) Successful in 1m30s
CI / Test (pull_request) Successful in 1m56s
CI / Build (pull_request) Successful in 1m36s
2024-05-20 04:49:48 -05:00
f8932166bb disable release update until fixed
All checks were successful
CI / Test (push) Successful in 1m10s
CI / Lint (push) Successful in 2m14s
CI / Test (pull_request) Successful in 1m39s
CI / Lint (pull_request) Successful in 1m54s
CI / Build (push) Successful in 3m3s
CI / Build (pull_request) Successful in 2m16s
2024-05-20 04:31:27 -05:00
ffd41348a0 small temporary fix for release updating not working
Some checks failed
CI / Test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Lint (pull_request) Successful in 2m7s
CI / Test (pull_request) Successful in 1m56s
CI / Build (pull_request) Successful in 3m18s
2024-05-20 04:29:53 -05:00
s1d3sw1ped
ff6381575e Merge pull request 'update-develop' (#26) from update-develop into develop
All checks were successful
CI / Lint (push) Successful in 1m35s
CI / Test (push) Successful in 1m27s
CI / Lint (pull_request) Successful in 1m47s
CI / Test (pull_request) Successful in 1m23s
CI / Build (push) Successful in 2m43s
CI / Build (pull_request) Successful in 2m23s
Reviewed-on: #26
2024-05-20 07:21:42 +00:00
s1d3sw1ped
acb4401e37 Merge pull request 'fix-ci' (#25) from fix-ci into master
All checks were successful
CI / Test (push) Successful in 1m39s
CI / Lint (push) Successful in 1m48s
CI / Build (push) Successful in 2m57s
CI / Test (pull_request) Successful in 1m43s
CI / Lint (pull_request) Successful in 1m53s
CI / Build (pull_request) Successful in 2m50s
Reviewed-on: #25
2024-05-20 07:01:22 +00:00
76d8c1744a fix ci stuff for other things
All checks were successful
CI / Test (pull_request) Successful in 1m36s
CI / Lint (pull_request) Successful in 1m39s
CI / Build (pull_request) Successful in 2m39s
2024-05-20 01:58:17 -05:00
s1d3sw1ped
b2bef77f09 Merge pull request 'small typo fix and removed unneeded global variable' (#23) from cleanup_typos into develop
Some checks failed
CI / Lint (push) Failing after 36s
CI / Test (push) Successful in 1m37s
CI / Test (pull_request) Successful in 1m17s
CI / Lint (pull_request) Successful in 1m55s
CI / Build (push) Successful in 2m56s
CI / Build (pull_request) Successful in 2m20s
Reviewed-on: #23
2024-05-20 06:51:53 +00:00
4cbb0666cb add run number to artifacts
All checks were successful
CI / Test (pull_request) Successful in 1m27s
CI / Lint (pull_request) Successful in 2m2s
CI / Build (pull_request) Successful in 2m41s
2024-05-20 01:47:36 -05:00
83cb34001f fyne metadata sucks so jst custom stuff
All checks were successful
CI / Test (pull_request) Successful in 1m17s
CI / Lint (pull_request) Successful in 1m58s
CI / Build (pull_request) Successful in 2m36s
2024-05-20 01:37:58 -05:00
1f09482950 remove version and build from fyneapp.toml
All checks were successful
CI / Test (pull_request) Successful in 1m32s
CI / Lint (pull_request) Successful in 1m57s
CI / Build (pull_request) Successful in 2m41s
2024-05-20 01:00:32 -05:00
1af4d225b5 add os dependencies to lint
All checks were successful
CI / Test (pull_request) Successful in 1m28s
CI / Lint (pull_request) Successful in 1m52s
CI / Build (pull_request) Successful in 2m47s
2024-05-20 00:47:05 -05:00
7863c53280 test
Some checks failed
CI / Lint (pull_request) Failing after 54s
CI / Test (pull_request) Successful in 2m3s
CI / Build (pull_request) Successful in 2m49s
2024-05-20 00:35:08 -05:00
s1d3sw1ped
35d888ec62 Merge pull request 'merge master into develop' (#22) from master into develop
All checks were successful
CI / Lint (push) Successful in 1m10s
CI / Test (push) Successful in 3m38s
CI / Build (push) Successful in 4m9s
Reviewed-on: #22
2024-03-12 05:16:43 +00:00
s1d3sw1ped
15e317b6fe Merge pull request 'fix' (#21) from fix3 into master
All checks were successful
CI / Lint (push) Successful in 50s
CI / Test (push) Successful in 3m32s
CI / Build (push) Successful in 4m4s
CI / Lint (pull_request) Successful in 1m2s
CI / Test (pull_request) Successful in 3m46s
CI / Build (pull_request) Successful in 4m18s
Reviewed-on: #21
2024-03-12 05:03:56 +00:00
07f11c7d22 fix
Some checks failed
CI / Build (pull_request) Has been cancelled
CI / Test (pull_request) Has been cancelled
CI / Lint (pull_request) Has been cancelled
2024-03-12 00:03:21 -05:00
s1d3sw1ped
7c28081b65 Merge pull request 'fix' (#20) from fix2 into master
All checks were successful
CI / Lint (push) Successful in 40s
CI / Build (push) Successful in 3m22s
CI / Test (push) Successful in 3m42s
Reviewed-on: #20
2024-03-12 04:56:40 +00:00
d9a75a5e21 fix
Some checks failed
CI / Test (pull_request) Has been cancelled
CI / Lint (pull_request) Has been cancelled
CI / Build (pull_request) Has been cancelled
2024-03-11 23:56:22 -05:00
s1d3sw1ped
5da6636dd7 Merge pull request 'blah' (#19) from fix into master
All checks were successful
CI / Lint (push) Successful in 55s
CI / Test (push) Successful in 3m45s
CI / Build (push) Successful in 4m16s
Reviewed-on: #19
2024-03-12 04:40:10 +00:00
b04e653350 blah
Some checks failed
CI / Test (pull_request) Has been cancelled
CI / Build (pull_request) Has been cancelled
CI / Lint (pull_request) Has been cancelled
2024-03-11 23:39:24 -05:00
s1d3sw1ped
8469610328 Merge pull request 'ci and general changes' (#18) from ci_and_edits into master
All checks were successful
CI / Lint (push) Successful in 46s
CI / Build (push) Successful in 3m36s
CI / Test (push) Successful in 4m7s
Reviewed-on: #18
2024-03-12 04:06:14 +00:00
9703682b4a try fixing ci again
All checks were successful
CI / Lint (pull_request) Successful in 54s
CI / Build (pull_request) Successful in 3m35s
CI / Test (pull_request) Successful in 4m0s
2024-03-11 21:59:14 -05:00
e281fbafdb ci and general changes
All checks were successful
CI / Lint (pull_request) Successful in 50s
CI / Build (pull_request) Successful in 3m46s
CI / Test (pull_request) Successful in 4m6s
2024-03-11 21:42:16 -05:00
5 changed files with 91 additions and 30 deletions

View File

@@ -19,6 +19,11 @@ jobs:
check-latest: true check-latest: true
cache: true cache: true
- name: Setup OS dependencies
run: |
apt-get update
apt-get install -y gcc-mingw-w64 gcc libgl1-mesa-dev xorg-dev
- name: Install go dependencies - name: Install go dependencies
run: go mod tidy run: go mod tidy
@@ -90,8 +95,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 BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION}.${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,17 +107,18 @@ 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 BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION}.${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
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: swiped-mod-switcher-${{github.ref_name}} name: swiped-mod-switcher-${{github.ref_name}}-${{github.run_number}}
path: bin/ path: bin/

View File

@@ -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:
@@ -20,6 +20,11 @@ jobs:
check-latest: true check-latest: true
cache: true cache: true
- name: Setup OS dependencies
run: |
apt-get update
apt-get install -y gcc-mingw-w64 gcc libgl1-mesa-dev xorg-dev
- name: Install go dependencies - name: Install go dependencies
run: go mod tidy run: go mod tidy
@@ -89,18 +94,32 @@ 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 BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}
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 BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}.exe
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
with: with:
name: swiped-mod-switcher-${{github.ref_name}} name: swiped-mod-switcher-${{github.ref_name}}-${{github.run_number}}
path: bin/ path: bin/

View File

@@ -21,6 +21,11 @@ jobs:
check-latest: true check-latest: true
cache: true cache: true
- name: Setup OS dependencies
run: |
apt-get update
apt-get install -y gcc-mingw-w64 gcc libgl1-mesa-dev xorg-dev
- name: Install go dependencies - name: Install go dependencies
run: go mod tidy run: go mod tidy
@@ -87,7 +92,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 --release --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}}
@@ -97,10 +102,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 --release --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}}
@@ -110,10 +114,15 @@ jobs:
CGO_ENABLED: 1 CGO_ENABLED: 1
CC: x86_64-w64-mingw32-gcc CC: x86_64-w64-mingw32-gcc
- name: Upload artifact
- name: Release binaries uses: actions/upload-artifact@v3
uses: https://gitea.com/actions/release-action@main
with: with:
files: |- name: swiped-mod-switcher-${{github.ref_name}}-${{github.run_number}}
bin/** path: bin/
api_key: '${{secrets.RELEASE_TOKEN}}'
# - name: Release binaries
# uses: https://gitea.com/actions/release-action@main
# with:
# files: |-
# bin/**
# api_key: '${{secrets.RELEASE_TOKEN}}'

View File

@@ -2,5 +2,3 @@
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"
Build = 2

44
main.go
View File

@@ -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"
@@ -18,8 +18,6 @@ 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"`
@@ -63,16 +61,42 @@ 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()
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()
@@ -138,9 +162,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"))
} }
} }
@@ -183,6 +211,6 @@ func makeIFunc(profile, archive string, parent fyne.Window) func() {
return return
} }
dialog.NewInformation("Success", fmt.Sprintf("filinked files from %s to %s", filepath.Base(profile), archive), parent).Show() dialog.NewInformation("Success", fmt.Sprintf("linked files from %s to %s", filepath.Base(profile), archive), parent).Show()
} }
} }