MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / folderForVaultRelativePath

Function folderForVaultRelativePath

packages/app-core/src/lib/vault-layout.ts:1222–1233  ·  view source on GitHub ↗
(
  relPath: string,
  settings: VaultSettings | null | undefined
)

Source from the content-addressed store, hash-verified

1220}
1221
1222export function folderForVaultRelativePath(
1223 relPath: string,
1224 settings: VaultSettings | null | undefined
1225): NoteFolder | null {
1226 const normalized = relPath.replace(/\\/g, '/').replace(/^\/+/, '')
1227 const top = normalized.split('/')[0] ?? ''
1228 if (!top || top.startsWith('.')) return null
1229 const system = systemFolderForTopSegment(top)
1230 if (system) return system
1231 if (isPrimaryNotesAtRoot(settings) && !RESERVED_ROOT_NAMES.has(top.toLowerCase())) return 'inbox'
1232 return null
1233}
1234
1235export function assetPathWithinFolder(
1236 assetPath: string,

Callers 6

SidebarFunction · 0.90
assetFolderSubpathFunction · 0.85
assetBelongsToFolderViewFunction · 0.85

Calls 2

isPrimaryNotesAtRootFunction · 0.85

Tested by

no test coverage detected