MCPcopy
hub / github.com/cortexlabs/cortex / MakeEmptyFile

Function MakeEmptyFile

pkg/lib/files/files.go:472–488  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

470}
471
472func MakeEmptyFile(path string) error {
473 cleanPath, err := Clean(path)
474 if err != nil {
475 return err
476 }
477
478 err = os.MkdirAll(filepath.Dir(cleanPath), os.ModePerm)
479 if err != nil {
480 return errors.Wrap(err, errors.Message(ErrorCreateDir(filepath.Dir(path))))
481 }
482 f, err := os.OpenFile(cleanPath, os.O_RDONLY|os.O_CREATE, 0666)
483 if err != nil {
484 return errors.Wrap(err, errors.Message(ErrorCreateFile(path)))
485 }
486 defer f.Close()
487 return nil
488}
489
490func MakeEmptyFiles(path string, paths ...string) error {
491 allPaths := append(paths, path)

Callers 2

MakeEmptyFilesFunction · 0.85
MakeEmptyFilesInDirFunction · 0.85

Calls 5

WrapFunction · 0.92
MessageFunction · 0.92
CleanFunction · 0.85
ErrorCreateDirFunction · 0.85
ErrorCreateFileFunction · 0.85

Tested by

no test coverage detected