NewFilePreferenceStorage 创建文件存储
(dir string)
| 35 | |
| 36 | // NewFilePreferenceStorage 创建文件存储 |
| 37 | func 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 接口 |
| 49 | func (fs *FilePreferenceStorage) Save( |
no outgoing calls