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

Function folderSubpathOf

apps/desktop/src/mcp/vault-ops.ts:657–664  ·  view source on GitHub ↗

* The note's directory relative to its top-level folder root ('' when * it sits at the folder root). Mirrors main/vault.ts: archive/trash * moves carry the subfolder along so the reverse move restores it.

(root: string, abs: string)

Source from the content-addressed store, hash-verified

655 * moves carry the subfolder along so the reverse move restores it.
656 */
657async function folderSubpathOf(root: string, abs: string): Promise<string> {
658 const folder = folderOf(root, abs)
659 if (!folder) return ''
660 const sourceRoot = await folderRoot(root, folder)
661 const relDir = path.relative(sourceRoot, path.dirname(abs))
662 if (!relDir || relDir.startsWith('..') || path.isAbsolute(relDir)) return ''
663 return toPosix(relDir)
664}
665
666async function moveBetweenFolders(
667 root: string,

Callers 1

moveBetweenFoldersFunction · 0.70

Calls 3

folderOfFunction · 0.70
folderRootFunction · 0.70
toPosixFunction · 0.70

Tested by

no test coverage detected