@@ -17,14 +17,12 @@ package cache
17
17
18
18
import (
19
19
"os"
20
- "path/filepath"
21
- "runtime"
22
20
23
21
"github.com/arduino/arduino-cli/cli/errorcodes"
24
22
"github.com/arduino/arduino-cli/cli/feedback"
25
- "github.com/arduino/go-win32-utils"
26
23
"github.com/sirupsen/logrus"
27
24
"github.com/spf13/cobra"
25
+ "github.com/spf13/viper"
28
26
)
29
27
30
28
func initCleanCommand () * cobra.Command {
@@ -42,34 +40,10 @@ func initCleanCommand() *cobra.Command {
42
40
func runCleanCommand (cmd * cobra.Command , args []string ) {
43
41
logrus .Info ("Executing `arduino cache clean`" )
44
42
45
- cachePath := getDefaultArduinoDataDir () + "/staging"
43
+ cachePath := viper . GetString ( "directories.Downloads" )
46
44
err := os .RemoveAll (cachePath )
47
45
if err != nil {
48
46
feedback .Errorf ("Error cleaning caches: %v" , err )
49
47
os .Exit (errorcodes .ErrGeneric )
50
48
}
51
49
}
52
-
53
- func getDefaultArduinoDataDir () string {
54
- userHomeDir , err := os .UserHomeDir ()
55
- if err != nil {
56
- feedback .Errorf ("Unable to get user home dir: %v" , err )
57
- return "."
58
- }
59
-
60
- switch runtime .GOOS {
61
- case "linux" :
62
- return filepath .Join (userHomeDir , ".arduino15" )
63
- case "darwin" :
64
- return filepath .Join (userHomeDir , "Library" , "Arduino15" )
65
- case "windows" :
66
- localAppDataPath , err := win32 .GetLocalAppDataFolder ()
67
- if err != nil {
68
- feedback .Errorf ("Unable to get Local App Data Folder: %v" , err )
69
- return "."
70
- }
71
- return filepath .Join (localAppDataPath , "Arduino15" )
72
- default :
73
- return "."
74
- }
75
- }
0 commit comments