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:
parent
226c6a0e93
commit
527994abba
5 changed files with 188 additions and 19 deletions
24
gamebanana/download_test.go
Normal file
24
gamebanana/download_test.go
Normal 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")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue