sectorbuilder: Always create directories

This commit is contained in:
Łukasz Magiera 2019-11-07 19:33:46 +01:00
parent 68adf519c7
commit 58c21b4a5e
2 changed files with 10 additions and 6 deletions

View File

@ -24,12 +24,6 @@ func TempSectorbuilder(sectorSize uint64) (*SectorBuilder, func(), error) {
staging := filepath.Join(dir, "staging")
cache := filepath.Join(dir, "cache")
for _, dir := range []string{metadata, sealed, staging, cache} {
if err := os.Mkdir(dir, 0755); err != nil {
return nil, nil, err
}
}
sb, err := New(&Config{
SectorSize: sectorSize,

View File

@ -2,6 +2,7 @@ package sectorbuilder
import (
"io"
"os"
"sort"
"unsafe"
@ -71,6 +72,15 @@ func New(cfg *Config) (*SectorBuilder, error) {
proverId := addressToProverID(cfg.Miner)
for _, dir := range []string{cfg.StagedDir, cfg.SealedDir, cfg.CacheDir, cfg.MetadataDir} {
if err := os.Mkdir(dir, 0755); err != nil {
if os.IsExist(err) {
continue
}
return nil, err
}
}
sbp, err := sectorbuilder.InitSectorBuilder(cfg.SectorSize, PoRepProofPartitions, 0, cfg.MetadataDir, proverId, cfg.SealedDir, cfg.StagedDir, cfg.CacheDir, 16, cfg.WorkerThreads)
if err != nil {
return nil, err