diff --git a/pkg/runtime/depot.go b/pkg/runtime/depot.go index 5154fd7c97..fc42fb8af8 100644 --- a/pkg/runtime/depot.go +++ b/pkg/runtime/depot.go @@ -45,8 +45,11 @@ type depot struct { fsMutex *sync.Mutex } -func newDepot() (*depot, error) { +func newDepot(volume string) (*depot, error) { depotPath := filepath.Join(storage.CachePath(), depotName) + if volume != "" { // Windows volume label for this depot + depotPath = filepath.Join(volume+"\\", "activestate", depotName) + } result := &depot{ config: depotConfig{ diff --git a/pkg/runtime/runtime.go b/pkg/runtime/runtime.go index 54fde6944d..2f450b271a 100644 --- a/pkg/runtime/runtime.go +++ b/pkg/runtime/runtime.go @@ -7,6 +7,7 @@ import ( "github.com/ActiveState/cli/internal/errs" "github.com/ActiveState/cli/internal/fileutils" + "github.com/ActiveState/cli/internal/installation/storage" "github.com/ActiveState/cli/internal/logging" "github.com/ActiveState/cli/pkg/buildplan" "github.com/ActiveState/cli/pkg/runtime/internal/envdef" @@ -46,7 +47,16 @@ func New(path string) (*Runtime, error) { return nil, errs.Wrap(err, "Could not create runtime directory") } - depot, err := newDepot() + // Windows does not support hard-linking across drives, so determine if the runtime path is on a + // separate drive than the default depot path. If so, use a drive-specific depot path when + // initializing the depot. + runtimeVolume := filepath.VolumeName(path) + storageVolume := filepath.VolumeName(storage.CachePath()) + if runtimeVolume == storageVolume { + runtimeVolume = "" + } + + depot, err := newDepot(runtimeVolume) if err != nil { return nil, errs.Wrap(err, "Could not create depot") }