* 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)
| 655 | * moves carry the subfolder along so the reverse move restores it. |
| 656 | */ |
| 657 | async 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 | |
| 666 | async function moveBetweenFolders( |
| 667 | root: string, |
no test coverage detected