From d6ad8517b7584be48f6af3b48c955a61664e0fe0 Mon Sep 17 00:00:00 2001 From: Dirk McCormick Date: Fri, 6 Aug 2021 10:40:49 +0200 Subject: [PATCH] feat: store temporary files in tmp folder under repo root --- node/modules/storageminer.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index 888af6980..876ba7b27 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -586,7 +586,15 @@ func StorageProvider(minerAddress dtypes.MinerAddress, dsw *dagstore.Wrapper, ) (storagemarket.StorageProvider, error) { 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 { return nil, err }