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

Function folderSubpathOf

apps/desktop/src/main/vault.ts:3195–3202  ·  view source on GitHub ↗

* The note's directory relative to its top-level folder root ('' when * it sits at the folder root). Carried along on archive/trash moves so * the reverse move puts the note back in the subfolder it came from.

(root: string, abs: string)

Source from the content-addressed store, hash-verified

3193 * the reverse move puts the note back in the subfolder it came from.
3194 */
3195async function folderSubpathOf(root: string, abs: string): Promise<string> {
3196 const folder = folderOf(root, abs)
3197 if (!folder) return ''
3198 const sourceRoot = await folderRoot(root, folder)
3199 const relDir = path.relative(sourceRoot, path.dirname(abs))
3200 if (!relDir || relDir.startsWith('..') || path.isAbsolute(relDir)) return ''
3201 return toPosix(relDir)
3202}
3203
3204async function moveBetweenFolders(
3205 root: string,

Callers 1

moveBetweenFoldersFunction · 0.70

Calls 3

folderOfFunction · 0.70
folderRootFunction · 0.70
toPosixFunction · 0.70

Tested by

no test coverage detected