Skip to content

Commit

Permalink
Download games to existing game-folder
Browse files Browse the repository at this point in the history
If a game is present in the game-directory and downloaded again the game
files are extracted to the already existing folder. Before they were
extracted to a folder called like the game slug, even if it was already
present in a different folder.
  • Loading branch information
seternate committed Sep 30, 2024
1 parent ab27d70 commit 7e1bae0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/controller/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"os"
"path"
"path/filepath"
"slices"
"strings"
"sync"
Expand Down Expand Up @@ -287,7 +288,13 @@ func (controller *Download) gameDataFilepath() string {
}

func (controller *Download) gameDataDestination() string {
return path.Join(controller.controller.settings.GameDirectory, controller.game.Slug)
gamedir := path.Join(controller.controller.settings.GameDirectory, controller.game.Slug)
paths, err := filesystem.SearchFilesBreadthFirst(controller.controller.Settings.Settings().GameDirectory, controller.game.Client.Executable, 3, 1)
if len(paths) > 0 && err == nil {
gamedir = filepath.Dir(paths[0])
}
fmt.Println(gamedir)
return gamedir
}

func (controller *Download) Subscribe(subscriber chan struct{}) {
Expand Down

0 comments on commit 7e1bae0

Please sign in to comment.