summaryrefslogtreecommitdiff
path: root/internal/config
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index a225a12..cd32c90 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -324,9 +324,22 @@ func configPath() (path string, isDefault bool, err error) {
return filepath.Join(dir, "lectio", "config.ini"), true, nil
}
+// calendarsDirOverride, when set, is returned by CalendarsDir verbatim,
+// bypassing the config-relative default. It lets a tool (e.g. clectio-gen) apply
+// calendar layers from an explicit directory without pointing the whole config
+// tree -- and without picking up an unrelated books.ini -- at that location.
+var calendarsDirOverride string
+
+// SetCalendarsDir overrides the directory CalendarsDir returns. Empty (the
+// default) restores the config-relative <config dir>/calendars.
+func SetCalendarsDir(dir string) { calendarsDirOverride = dir }
+
// CalendarsDir returns the directory holding user calendar-layer files
-// (<config dir>/calendars).
+// (<config dir>/calendars, unless overridden by SetCalendarsDir).
func CalendarsDir() (string, error) {
+ if calendarsDirOverride != "" {
+ return calendarsDirOverride, nil
+ }
p, _, err := configPath()
if err != nil {
return "", err