Initial logic is implemented

This commit is contained in:
Nikolai Rodionov
2023-07-20 11:26:25 +02:00
committed by Nikolai Rodionov
parent 619a86b7f8
commit 625450ca25
51 changed files with 4533 additions and 5 deletions

View File

@ -0,0 +1,26 @@
package workdir
import "os"
func CreateWorkdir(path string) (workdir string, err error) {
if len(path) > 0 {
// Create a dir using the path
if err := os.Mkdir(path, 0777); err != nil {
return path, err
}
// TODO(@allanger): I've got a feeling that it doesn't have to look that bad
workdir = path
} else {
// Create a temporary dir
workdir, err = os.MkdirTemp("", "shoebill")
if err != nil {
return workdir, err
}
}
return workdir, nil
}
func RemoveWorkdir(path string) (err error) {
return os.RemoveAll(path)
}