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

Function duplicateFolderIcons

apps/desktop/src/main/vault.ts:1070–1089  ·  view source on GitHub ↗
(
  folderIcons: Record<string, FolderIconId>,
  folder: NoteFolder,
  sourceSubpath: string,
  targetSubpath: string
)

Source from the content-addressed store, hash-verified

1068}
1069
1070function duplicateFolderIcons(
1071 folderIcons: Record<string, FolderIconId>,
1072 folder: NoteFolder,
1073 sourceSubpath: string,
1074 targetSubpath: string
1075): Record<string, FolderIconId> {
1076 const next: Record<string, FolderIconId> = { ...folderIcons }
1077 const exactKey = folderIconKey(folder, sourceSubpath)
1078 const prefix = `${exactKey}/`
1079 for (const [key, value] of Object.entries(folderIcons)) {
1080 if (key === exactKey) {
1081 next[folderIconKey(folder, targetSubpath)] = value
1082 continue
1083 }
1084 if (key.startsWith(prefix)) {
1085 next[folderIconKey(folder, targetSubpath) + key.slice(exactKey.length)] = value
1086 }
1087 }
1088 return next
1089}
1090
1091async function inferPrimaryNotesLocation(root: string): Promise<PrimaryNotesLocation> {
1092 let entries: Dirent[]

Callers 1

duplicateFolderFunction · 0.70

Calls 1

folderIconKeyFunction · 0.70

Tested by

no test coverage detected