feat: store temporary files in tmp folder under repo root

This commit is contained in:
Dirk McCormick 2021-08-06 10:40:49 +02:00
parent 25f61c8a5d
commit d6ad8517b7

View File

@ -586,7 +586,15 @@ func StorageProvider(minerAddress dtypes.MinerAddress,
dsw *dagstore.Wrapper, dsw *dagstore.Wrapper,
) (storagemarket.StorageProvider, error) { ) (storagemarket.StorageProvider, error) {
net := smnet.NewFromLibp2pHost(h) net := smnet.NewFromLibp2pHost(h)
store, err := piecefilestore.NewLocalFileStore(piecefilestore.OsPath(r.Path()))
// Create a directory under the repo path for temporary files
repoTmpPath := filepath.Join(r.Path(), "tmp")
err := os.MkdirAll(repoTmpPath, 0755) //nolint: gosec
if err != nil {
return nil, xerrors.Errorf("creating tmp dir for storage provider repo: %w", err)
}
store, err := piecefilestore.NewLocalFileStore(piecefilestore.OsPath(repoTmpPath))
if err != nil { if err != nil {
return nil, err return nil, err
} }