gamebanana: add function for downloading mods

kinda janky with the implementation right now, later i would like to
improve the way files are copied and allow for mods with multiple
downloads attached to the mod. probably split off some of the
functionality later to add installing mods not on gamebanana easier.
This commit is contained in:
Nico 2025-08-30 00:04:45 +10:00
parent 226c6a0e93
commit 527994abba
Signed by: nico
SSH key fingerprint: SHA256:XuacYOrGqRxC3jVFjfLROn1CSvLz85Dec6N7O9Gwu/0
5 changed files with 188 additions and 19 deletions

View file

@ -0,0 +1,24 @@
package gamebanana
import (
"os"
"path"
"testing"
)
func TestDownloadGameBananaMod(t *testing.T) {
tmpdir := t.TempDir()
err := DownloadGameBananaMod("602180", tmpdir)
if err != nil {
t.Error("failed to download game banana mod", err)
}
// udate is the time the mod was last updated
// in unix time, used here as a version number
// modID@udate
expectedPathToExist := path.Join(tmpdir, "602180@1750696716")
if _, err := os.Stat(expectedPathToExist); err != nil {
t.Error("mod doesn't have expected name or doesn't exist")
}
}