pulumi/pkg/tools/paths.go
Pat Gavlin a23b10a9bf
Update the copyright end date to 2018. (#1068)
Just what it says on the tin.
2018-03-21 12:43:21 -07:00

19 lines
506 B
Go

// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
package tools
import (
"os"
"path/filepath"
)
// EnsureDir ensures that a target directory exists (like `mkdir -p`), returning a non-nil error if any problem occurs.
func EnsureDir(dir string) error {
return os.MkdirAll(dir, 0700)
}
// EnsureFileDir ensures that a target file's parent directory exists, returning a non-nil error if any problem occurs.
func EnsureFileDir(path string) error {
return EnsureDir(filepath.Dir(path))
}