File tree Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -57,12 +57,31 @@ func (fsc *FilesystemCache) Location(pkg *Package) (path string, exists bool) {
57
57
return "" , false
58
58
}
59
59
60
- fn := filepath .Join (fsc .Origin , fmt .Sprintf ("%s.tar.gz" , version ))
61
- if _ , err := os .Stat (fn ); os .IsNotExist (err ) {
62
- return fn , false
60
+ // Check for .tar.gz file first
61
+ gzPath := filepath .Join (fsc .Origin , fmt .Sprintf ("%s.tar.gz" , version ))
62
+ if fileExists (gzPath ) {
63
+ return gzPath , true
63
64
}
64
65
65
- return fn , true
66
+ // Fall back to .tar file
67
+ tarPath := filepath .Join (fsc .Origin , fmt .Sprintf ("%s.tar" , version ))
68
+ exists = fileExists (tarPath )
69
+
70
+ return tarPath , exists
71
+ }
72
+
73
+ // fileExists checks if a file exists and is not a directory
74
+ func fileExists (filename string ) bool {
75
+ info , err := os .Stat (filename )
76
+ if err != nil {
77
+ if os .IsNotExist (err ) {
78
+ return false
79
+ }
80
+
81
+ return false
82
+ }
83
+
84
+ return ! info .IsDir ()
66
85
}
67
86
68
87
// RemoteCache can download and upload build artifacts into a local cache
You can’t perform that action at this time.
0 commit comments