Skip to content

Commit e98783f

Browse files
authored
Merge pull request #3801 from ActiveState/mitchell/cp-1289
Fixed cache dir path on Windows.
2 parents e9e4128 + 3aae73f commit e98783f

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

internal/installation/storage/storage.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@ func CachePath() string {
105105
return path
106106
}
107107

108-
return filepath.Join(BaseCachePath(), relativeCachePath())
108+
cachePath = filepath.Join(BaseCachePath(), relativeCachePath())
109+
if runtime.GOOS == "windows" {
110+
// Explicitly append "cache" dir as the cachedir on Windows.
111+
// It is the same as the local appdata dir (conflicts with config)
112+
cachePath = filepath.Join(cachePath, "cache")
113+
}
114+
return cachePath
109115
}
110116

111117
func GlobalBinDir() string {

internal/installation/storage/storage_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ func BaseCachePath() string {
1818
return cache
1919
}
2020

21-
return filepath.Join(homeDir, "AppData", "Local", "cache")
21+
return filepath.Join(homeDir, "AppData", "Local")
2222
}

test/integration/use_int_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ func (suite *UseIntegrationTestSuite) TestReset() {
126126

127127
cfg, err := config.New()
128128
suite.NoError(err)
129+
rcfile, err := subshell.New(cfg).RcFile()
130+
suite.NoError(err)
129131
if runtime.GOOS != "windows" {
130-
rcfile, err := subshell.New(cfg).RcFile()
131132
fileutils.FileExists(rcfile)
132-
suite.NoError(err)
133133
suite.Contains(string(fileutils.ReadFileUnsafe(rcfile)), ts.Dirs.DefaultBin, "PATH does not have your project in it")
134134
}
135135

0 commit comments

Comments
 (0)