Skip to content

Commit

Permalink
support multi-overlay, fixes #369
Browse files Browse the repository at this point in the history
  • Loading branch information
apprehensions committed Feb 18, 2024
1 parent 6f40d4d commit ae3623a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 26 deletions.
15 changes: 13 additions & 2 deletions cmd/vinegar/binary_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import (
"os"
"path/filepath"
"sort"
"errors"
"strings"

cp "github.com/otiai10/copy"
"github.com/vinegarhq/vinegar/internal/dirs"
"github.com/vinegarhq/vinegar/roblox"
boot "github.com/vinegarhq/vinegar/roblox/bootstrapper"
Expand Down Expand Up @@ -59,8 +62,16 @@ func (b *Binary) Setup() error {
return fmt.Errorf("apply fflags: %w", err)
}

if err := dirs.OverlayDir(b.Dir); err != nil {
return fmt.Errorf("overlay dir: %w", err)
overlayDir := filepath.Join(dirs.Overlays, strings.ToLower(b.Type.String()))
_, err := os.Stat(overlayDir)
if err != nil && !errors.Is(err, os.ErrNotExist) {
return fmt.Errorf("stat overlay: %w", err)
} else if err == nil {
slog.Info("Copying Overlay directory's files", "src", overlayDir, "path", b.Dir)

if err := cp.Copy(overlayDir, b.Dir); err != nil {
return fmt.Errorf("overlay dir: %w", err)
}
}

if err := b.SetupDxvk(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/vinegar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ func Delete() error {
}

return nil
}
}
22 changes: 0 additions & 22 deletions internal/dirs/copy.go

This file was deleted.

4 changes: 3 additions & 1 deletion internal/dirs/dirs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ var (
Cache = filepath.Join(xdg.CacheHome, "vinegar")
Config = filepath.Join(xdg.ConfigHome, "vinegar")
Data = filepath.Join(xdg.DataHome, "vinegar")
Overlay = filepath.Join(Config, "overlay")
Overlays = filepath.Join(Config, "overlays")
Downloads = filepath.Join(Cache, "downloads")
Logs = filepath.Join(Cache, "logs")
Prefixes = filepath.Join(Data, "prefixes")
Versions = filepath.Join(Data, "versions")

// Deprecated: Vinegar supports multiple wine prefixes
Prefix = filepath.Join(Data, "prefix")
// Deprecated: Vinegar supports multiple overlays for each Player and Studio
Overlay = filepath.Join(Config, "overlay")
)

func Mkdirs(dirs ...string) error {
Expand Down

0 comments on commit ae3623a

Please sign in to comment.