(shortcuts []directoryBrowseShortcut, label string, path string)
| 384 | } |
| 385 | |
| 386 | func appendBrowseShortcut(shortcuts []directoryBrowseShortcut, label string, path string) []directoryBrowseShortcut { |
| 387 | cleaned := strings.TrimSpace(path) |
| 388 | if cleaned == "" { |
| 389 | return shortcuts |
| 390 | } |
| 391 | for _, shortcut := range shortcuts { |
| 392 | if shortcut.Path == cleaned { |
| 393 | return shortcuts |
| 394 | } |
| 395 | } |
| 396 | if info, err := os.Stat(cleaned); err != nil || !info.IsDir() { |
| 397 | return shortcuts |
| 398 | } |
| 399 | return append(shortcuts, directoryBrowseShortcut{Label: label, Path: cleaned}) |
| 400 | } |
| 401 | |
| 402 | func browseRootLabel(path string, index int) string { |
| 403 | cleaned := filepath.Clean(path) |
no test coverage detected