sectorbuilder: Always create directories
This commit is contained in:
parent
68adf519c7
commit
58c21b4a5e
@ -24,12 +24,6 @@ func TempSectorbuilder(sectorSize uint64) (*SectorBuilder, func(), error) {
|
|||||||
staging := filepath.Join(dir, "staging")
|
staging := filepath.Join(dir, "staging")
|
||||||
cache := filepath.Join(dir, "cache")
|
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{
|
sb, err := New(&Config{
|
||||||
SectorSize: sectorSize,
|
SectorSize: sectorSize,
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package sectorbuilder
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
@ -71,6 +72,15 @@ func New(cfg *Config) (*SectorBuilder, error) {
|
|||||||
|
|
||||||
proverId := addressToProverID(cfg.Miner)
|
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)
|
sbp, err := sectorbuilder.InitSectorBuilder(cfg.SectorSize, PoRepProofPartitions, 0, cfg.MetadataDir, proverId, cfg.SealedDir, cfg.StagedDir, cfg.CacheDir, 16, cfg.WorkerThreads)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user