MCPcopy Create free account
hub / github.com/astercloud/aster / NewFilePreferenceStorage

Function NewFilePreferenceStorage

pkg/memory/preference_storage.go:37–46  ·  view source on GitHub ↗

NewFilePreferenceStorage 创建文件存储

(dir string)

Source from the content-addressed store, hash-verified

35
36// NewFilePreferenceStorage 创建文件存储
37func NewFilePreferenceStorage(dir string) (*FilePreferenceStorage, error) {
38 // 确保目录存在
39 if err := os.MkdirAll(dir, 0755); err != nil {
40 return nil, fmt.Errorf("failed to create storage directory: %w", err)
41 }
42
43 return &FilePreferenceStorage{
44 dir: dir,
45 }, nil
46}
47
48// Save 实现 PreferenceStorage 接口
49func (fs *FilePreferenceStorage) Save(

Calls

no outgoing calls