From 7a19e2f38d585adf26b2bc5e339fe6da5fd6044c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Sat, 9 Apr 2022 12:03:11 +0200 Subject: [PATCH] Manager: use absolute storage path This helps to get things consistent on Windows and Linux. Otherwise a path like `/some/path` is absolute on one platform but not on the other. This is mostly for getting the unit tests in this package to work on Windows, but using absolute paths also helps in clarity of error logging. --- internal/manager/config/config.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/manager/config/config.go b/internal/manager/config/config.go index 209483dc..51a8a684 100644 --- a/internal/manager/config/config.go +++ b/internal/manager/config/config.go @@ -245,6 +245,15 @@ func (c *Conf) processAfterLoading(override ...func(c *Conf)) { } func (c *Conf) processStorage() { + storagePath, err := filepath.Abs(c.StoragePath) + if err != nil { + log.Error().Err(err). + Str("storage_path", c.StoragePath). + Msg("unable to determine absolute storage path") + } else { + c.StoragePath = storagePath + } + // Shaman should use the Flamenco storage location. if c.Shaman.Enabled { c.Shaman.StoragePath = c.StoragePath