airobot/storage/storage.go
2022-12-12 08:30:21 +08:00

30 lines
507 B
Go

package storage
import "path/filepath"
const (
storageRootName = "storage"
configFileName = "airobot.json"
ID = "zhaocy.df"
Version = "zhaocy/df/v1"
)
type Storage interface {
Root() string
ConfigStorage
}
type ConfigStorage interface {
LoadConfig() (*Config, error)
StoreConfig(s *Config) error
}
func storageRootPath(s Storage) string {
return filepath.Join(s.Root(), storageRootName)
}
func configPath(s Storage) string {
return filepath.Join(storageRootPath(s), configFileName)
}