MCPcopy Index your code
hub / github.com/ZenNotes/zennotes / browseShortcuts

Method browseShortcuts

apps/server/internal/httpserver/browse_roots.go:104–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

102}
103
104func (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}

Callers 1

browseDirectoriesMethod · 0.95

Calls 7

effectiveBrowseRootsMethod · 0.95
currentVaultMethod · 0.95
defaultBrowsePathMethod · 0.95
appendBrowseShortcutFunction · 0.85
browseRootLabelFunction · 0.85
filesystemRootForPathFunction · 0.85
RootMethod · 0.80

Tested by

no test coverage detected