forked from Plemya-x/ALR
		
	chore: simplify dlcache initialization
This commit is contained in:
		| @@ -32,19 +32,15 @@ type Config interface { | ||||
| } | ||||
|  | ||||
| type DownloadCache struct { | ||||
| 	cfg Config | ||||
| 	cacheDir string | ||||
| } | ||||
|  | ||||
| func New(cfg Config) *DownloadCache { | ||||
| 	return &DownloadCache{ | ||||
| 		cfg, | ||||
| 	} | ||||
| func New(cacheDir string) *DownloadCache { | ||||
| 	return &DownloadCache{cacheDir} | ||||
| } | ||||
|  | ||||
| func (dc *DownloadCache) BasePath(ctx context.Context) string { | ||||
| 	return filepath.Join( | ||||
| 		dc.cfg.GetPaths().CacheDir, "dl", | ||||
| 	) | ||||
| 	return filepath.Join(dc.cacheDir, "dl") | ||||
| } | ||||
|  | ||||
| // New creates a new directory with the given ID in the cache. | ||||
|   | ||||
| @@ -64,7 +64,7 @@ func TestNew(t *testing.T) { | ||||
| 	cfg := prepare(t) | ||||
| 	defer cleanup(t, cfg) | ||||
|  | ||||
| 	dc := dlcache.New(cfg) | ||||
| 	dc := dlcache.New(cfg.GetPaths().CacheDir) | ||||
|  | ||||
| 	ctx := context.Background() | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user