diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2021-01-08 23:03:01 -0500 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2021-01-08 23:03:32 -0500 |
| commit | d762cdbae06efd194ffac7b976c16aac21a26f94 (patch) | |
| tree | 91372f7cb8118dea56255d0f35294574df339ed0 /steam/steam.go | |
| parent | 11c0e0ca37ce58d74f3cd5831265b9912f6bc8ea (diff) | |
| download | steam-export-d762cdbae06efd194ffac7b976c16aac21a26f94.tar.gz steam-export-d762cdbae06efd194ffac7b976c16aac21a26f94.tar.xz | |
Also show the size of games on the page listing
Diffstat (limited to 'steam/steam.go')
| -rw-r--r-- | steam/steam.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/steam/steam.go b/steam/steam.go index 8c3dcbb..24e4c54 100644 --- a/steam/steam.go +++ b/steam/steam.go @@ -3,10 +3,10 @@ package steam import ( + "bufio" + "errors" "fmt" "io/ioutil" - "errors" - "bufio" "os" "path/filepath" "strings" @@ -20,6 +20,7 @@ type Library struct { type Game struct { Name string LibraryPath string + Size int64 } func ProcessMultipleLibraries(r []string) ([]*Library, error) { @@ -44,7 +45,7 @@ func NewLibrary(path string) (*Library, error) { return l, err } -func NewLibraryMust(path string) (*Library) { +func NewLibraryMust(path string) *Library { l, err := NewLibrary(path) if err != nil { panic(err) @@ -67,11 +68,13 @@ func (s *Library) ProcessLibrary(r string) error { s.Folder = r for _, f := range dirs { if f.IsDir() { - s.Games[f.Name()] = Game{ + g := &Game{ Name: f.Name(), LibraryPath: r, } - // s.Games = append(s.Games, f.Name()) + g.setSizeInfo() + + s.Games[f.Name()] = *g } } |
