-func (ctx *Ctx) ensureRxDir(nodeId *NodeId) error {
- dirPath := filepath.Join(ctx.Spool, nodeId.String(), string(TRx))
- logMsg := func(les LEs) string {
- return fmt.Sprintf("Ensuring directory %s existence", dirPath)
+func ensureDir(dirs ...string) error {
+ p := filepath.Join(dirs...)
+ fi, err := os.Stat(p)
+ if err == nil {
+ if fi.IsDir() {
+ return nil
+ }
+ return fmt.Errorf("%s: is not a directory", p)