Implement game path manipulation

This commit is contained in:
2025-01-11 23:19:45 +01:00
parent c975aee3cb
commit 156c5770e8
3 changed files with 33 additions and 6 deletions

21
app.go
View File

@@ -37,6 +37,10 @@ type StringResponse struct {
Data string `json:"data"`
Error string `json:"error,omitempty"`
}
type BoolResponse struct {
Data bool `json:"data"`
Error string `json:"error,omitempty"`
}
func (a *App) GetAddons() (res AddonsResponse) {
res.Data = addonService.Addons
@@ -78,3 +82,20 @@ func (a *App) UpdateAddon(name string) (res AddonResponse) {
}
return res
}
func (a *App) GetGamePath() (res StringResponse) {
res.Data = settings.GamePath
return res
}
func (a *App) SetGamePath(path string) (res StringResponse) {
settings.GamePath = path
SaveSettings(*settings)
res.Data = path
return res
}
func (a *App) IsGamePathValid() (res BoolResponse) {
res.Data = settings.GamePath != ""
return res
}