From a61c1d20f3887366c3576bced01762acd52173ab Mon Sep 17 00:00:00 2001 From: jdkato Date: Sat, 6 Jan 2024 21:41:12 -0800 Subject: [PATCH] fix: handle relative StylePaths --- internal/core/ini.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/core/ini.go b/internal/core/ini.go index 7b27aa9b..7464c438 100644 --- a/internal/core/ini.go +++ b/internal/core/ini.go @@ -85,9 +85,15 @@ var globalOpts = map[string]func(*ini.Section, *Config, []string){ var coreOpts = map[string]func(*ini.Section, *Config, []string) error{ "StylesPath": func(sec *ini.Section, cfg *Config, args []string) error { paths := sec.Key("StylesPath").ValueWithShadows() - if cfg.Flags.Local && len(paths) == 2 { - basePath := determinePath(args[0], filepath.FromSlash(paths[1])) + if cfg.Flags.Local && len(args) == 2 { + // This case handles the situation where both configs define the + // same StylesPath (e.g., `StylesPath = styles`). + basePath := determinePath(args[0], filepath.FromSlash(paths[0])) mockPath := determinePath(args[1], filepath.FromSlash(paths[0])) + if len(paths) == 2 { + basePath = determinePath(args[0], filepath.FromSlash(paths[1])) + mockPath = determinePath(args[1], filepath.FromSlash(paths[0])) + } cfg.Paths = []string{basePath, mockPath} cfg.StylesPath = basePath } else {