(config common.Config)
| 212 | } |
| 213 | |
| 214 | func ListDriveScripts(config common.Config) ([]DriveScript, error) { |
| 215 | scriptsPath, _ := config.GetDir(config.DrivesDir, false) |
| 216 | entries, e := os.ReadDir(scriptsPath) |
| 217 | if e != nil { |
| 218 | return []DriveScript{}, nil |
| 219 | } |
| 220 | result := make([]DriveScript, 0) |
| 221 | for _, entry := range entries { |
| 222 | n := strings.ToLower(entry.Name()) |
| 223 | if !strings.HasSuffix(n, ".js") { |
| 224 | continue |
| 225 | } |
| 226 | ds, e := readDriveScriptMeta(entry.Name(), config) |
| 227 | if e != nil { |
| 228 | continue |
| 229 | } |
| 230 | result = append(result, ds) |
| 231 | } |
| 232 | return result, nil |
| 233 | } |
| 234 | |
| 235 | func readDriveScriptMeta(file string, config common.Config) (DriveScript, error) { |
| 236 | scriptsPath, _ := config.GetDir(config.DrivesDir, false) |
no test coverage detected