github.com/NebulousLabs/Sia@v1.3.7/siatest/dir.go (about)

     1  package siatest
     2  
     3  import (
     4  	"os"
     5  	"path/filepath"
     6  )
     7  
     8  var (
     9  	// SiaTestingDir is the directory that contains all of the files and
    10  	// folders created during testing.
    11  	SiaTestingDir = filepath.Join(os.TempDir(), "SiaTesting")
    12  )
    13  
    14  // TestDir joins the provided directories and prefixes them with the Sia
    15  // testing directory, removing any files or directories that previously existed
    16  // at that location.
    17  func TestDir(dirs ...string) (string, error) {
    18  	path := filepath.Join(SiaTestingDir, filepath.Join(dirs...))
    19  	err := os.RemoveAll(path)
    20  	if err != nil {
    21  		return "", err
    22  	}
    23  	return path, nil
    24  }