From 82243f5f550be2da35409061b44f9a9f0da3a172 Mon Sep 17 00:00:00 2001 From: Will Brode Date: Wed, 15 May 2024 15:05:42 -0700 Subject: [PATCH] fix: Allow relative paths for 'cache' and 'dir' options. Fixes #250. --- internal/volume/volume.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/volume/volume.go b/internal/volume/volume.go index 617ff410..865e2adb 100644 --- a/internal/volume/volume.go +++ b/internal/volume/volume.go @@ -65,6 +65,11 @@ func Mount(workDirHost string, cacheDirHost string) (Volume, error) { if err != nil { return Volume{}, err } + } else { + workDirHost, err = filepath.Abs(workDirHost) + if err != nil { + return Volume{}, fmt.Errorf("could not make the root directory %s an absolute path: %w", workDirHost, err) + } } if cacheDirHost == "" { @@ -72,6 +77,11 @@ func Mount(workDirHost string, cacheDirHost string) (Volume, error) { if err != nil { return Volume{}, err } + } else { + cacheDirHost, err = filepath.Abs(cacheDirHost) + if err != nil { + return Volume{}, fmt.Errorf("could not make the cache directory %s an absolute path: %w", cacheDirHost, err) + } } l := Volume{