moth/cmd/mothd/common.go

29 lines
523 B
Go
Raw Normal View History

2019-09-02 18:42:27 -06:00
package main
import (
"path/filepath"
"strings"
2019-09-02 19:47:24 -06:00
"time"
2019-09-02 18:42:27 -06:00
)
2019-09-02 19:47:24 -06:00
type Component struct {
baseDir string
}
func (c *Component) path(parts ...string) string {
2019-09-02 18:42:27 -06:00
path := filepath.Clean(filepath.Join(parts...))
parts = filepath.SplitList(path)
for i, part := range parts {
part = strings.TrimLeft(part, "./\\:")
parts[i] = part
}
2019-09-02 19:47:24 -06:00
parts = append([]string{c.baseDir}, parts...)
2019-09-02 18:42:27 -06:00
path = filepath.Join(parts...)
path = filepath.Clean(path)
return path
}
2019-09-02 19:47:24 -06:00
func (c *Component) Run(updateInterval time.Duration) {
// Stub!
}