diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2017-01-06 18:06:34 -0500 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2017-01-06 18:06:34 -0500 |
| commit | daa78703abcd467936fb498a1ca4deb85a2fe419 (patch) | |
| tree | 3105a06622c45413d93b92cf3ff83fd02f204b09 /steam | |
| parent | c5d68db9fb5f831106ce3eb12048e8f9005e531b (diff) | |
| download | steam-export-daa78703abcd467936fb498a1ca4deb85a2fe419.tar.gz steam-export-daa78703abcd467936fb498a1ca4deb85a2fe419.tar.xz | |
Added an archive library and ability to package steam games
Diffstat (limited to 'steam')
| -rw-r--r-- | steam/package.go | 26 | ||||
| -rw-r--r-- | steam/steam.go | 4 |
2 files changed, 29 insertions, 1 deletions
diff --git a/steam/package.go b/steam/package.go new file mode 100644 index 0000000..690ac4a --- /dev/null +++ b/steam/package.go @@ -0,0 +1,26 @@ +package steam + +import ( + "git.riedstra.us/mitch/steam-export/archive" + "os" +) + +func (l *Library) PackageGame(g string) error { + working_dir, err := os.Getwd() + if err != nil { + return err + } + output := working_dir + "/" + g + ".tar" + + os.Chdir(l.Folder + common) + input := g + a := archive.Archive{Output: output, Input: input} + err = a.Tar() + if err != nil { + return err + } + + os.Chdir(working_dir) + + return nil +} diff --git a/steam/steam.go b/steam/steam.go index 1f764f2..5214cc1 100644 --- a/steam/steam.go +++ b/steam/steam.go @@ -20,6 +20,8 @@ type Library struct { Games []string } +var common string = "/common" + func ProcessMultipleLibraries(r []string) ([]*Library, error) { var libs []*Library for _, i := range r { @@ -36,7 +38,7 @@ func ProcessMultipleLibraries(r []string) ([]*Library, error) { // Populate the "Folder" and "Games" fields based on the provided directory func (s *Library) ProcessLibrary(r string) error { if hasCommon(r) { - dirs, err := ioutil.ReadDir(r + "/common") + dirs, err := ioutil.ReadDir(r + common) if err != nil { return err } |
