()
| 102 | } |
| 103 | |
| 104 | func (s *Server) browseShortcuts() []directoryBrowseShortcut { |
| 105 | shortcuts := make([]directoryBrowseShortcut, 0, 8) |
| 106 | roots := s.effectiveBrowseRoots() |
| 107 | for idx, rootPath := range roots { |
| 108 | shortcuts = appendBrowseShortcut(shortcuts, browseRootLabel(rootPath, idx), rootPath) |
| 109 | } |
| 110 | if current := s.currentVault(); current != nil { |
| 111 | shortcuts = appendBrowseShortcut(shortcuts, "Current Vault", current.Root()) |
| 112 | } |
| 113 | if len(roots) == 0 { |
| 114 | root := filesystemRootForPath(s.defaultBrowsePath()) |
| 115 | shortcuts = appendBrowseShortcut(shortcuts, "Root", root) |
| 116 | if home, err := os.UserHomeDir(); err == nil && strings.TrimSpace(home) != "" { |
| 117 | shortcuts = appendBrowseShortcut(shortcuts, "Home", home) |
| 118 | shortcuts = appendBrowseShortcut(shortcuts, "Desktop", filepath.Join(home, "Desktop")) |
| 119 | shortcuts = appendBrowseShortcut(shortcuts, "Documents", filepath.Join(home, "Documents")) |
| 120 | shortcuts = appendBrowseShortcut(shortcuts, "Downloads", filepath.Join(home, "Downloads")) |
| 121 | if runtime.GOOS == "darwin" { |
| 122 | shortcuts = appendBrowseShortcut( |
| 123 | shortcuts, |
| 124 | "iCloud Drive", |
| 125 | filepath.Join(home, "Library", "Mobile Documents", "com~apple~CloudDocs"), |
| 126 | ) |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 | return shortcuts |
| 131 | } |
no test coverage detected