diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2017-01-10 12:44:56 -0500 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2017-01-10 12:44:56 -0500 |
| commit | ab2338daadbb826063c1ff299a9e39bb41e40317 (patch) | |
| tree | f992b36f0cd64199b48687d91c19fe5b5af2777f /steam/steam.go | |
| parent | 859b67383410b279707d86604dfdbfe9de893ca9 (diff) | |
| download | steam-export-ab2338daadbb826063c1ff299a9e39bb41e40317.tar.gz steam-export-ab2338daadbb826063c1ff299a9e39bb41e40317.tar.xz | |
Finding the ACF file now only returns the filename instead of the full path. When you package a game the ACF file is now included.
Diffstat (limited to 'steam/steam.go')
| -rw-r--r-- | steam/steam.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/steam/steam.go b/steam/steam.go index 5214cc1..9715f38 100644 --- a/steam/steam.go +++ b/steam/steam.go @@ -20,8 +20,6 @@ type Library struct { Games []string } -var common string = "/common" - func ProcessMultipleLibraries(r []string) ([]*Library, error) { var libs []*Library for _, i := range r { @@ -38,7 +36,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 } @@ -54,8 +52,14 @@ func (s *Library) ProcessLibrary(r string) error { // Find the ACF files related to this video game func (l *Library) FindACF(g string) (string, error) { - globFolder := l.Folder + "/*.acf" - files, err := filepath.Glob(globFolder) + working_dir, err := os.Getwd() + if err != nil { + return "", err + } + if err = os.Chdir(l.Folder); err != nil { + return "", err + } + files, err := filepath.Glob("*.acf") if err != nil { return "", err } @@ -79,6 +83,7 @@ func (l *Library) FindACF(g string) (string, error) { for scanner.Scan() { // Finally check and see if the file has the video game name if strings.Contains(scanner.Text(), g) { + os.Chdir(working_dir) return fn, nil // fmt.Printf("%s/%s:%d: %s\n", root, path, i, scanner.Text()) } |
