(cfg config.FolderConfiguration, content []string)
| 2233 | } |
| 2234 | |
| 2235 | func (m *model) setIgnores(cfg config.FolderConfiguration, content []string) error { |
| 2236 | err := cfg.CheckPath() |
| 2237 | if errors.Is(err, config.ErrPathMissing) { |
| 2238 | if err = cfg.CreateRoot(); err != nil { |
| 2239 | return fmt.Errorf("failed to create folder root: %w", err) |
| 2240 | } |
| 2241 | err = cfg.CheckPath() |
| 2242 | } |
| 2243 | if err != nil && !errors.Is(err, config.ErrMarkerMissing) { |
| 2244 | return err |
| 2245 | } |
| 2246 | |
| 2247 | if err := ignore.WriteIgnores(cfg.Filesystem(), ".stignore", content); err != nil { |
| 2248 | slog.Error("Failed to save .stignore", slogutil.Error(err)) |
| 2249 | return err |
| 2250 | } |
| 2251 | |
| 2252 | m.mut.RLock() |
| 2253 | runner, ok := m.folderRunners.Get(cfg.ID) |
| 2254 | m.mut.RUnlock() |
| 2255 | if ok { |
| 2256 | runner.ScheduleScan() |
| 2257 | } |
| 2258 | return nil |
| 2259 | } |
| 2260 | |
| 2261 | // OnHello is called when an device connects to us. |
| 2262 | // This allows us to extract some information from the Hello message |
no test coverage detected