MCPcopy
hub / github.com/callumalpass/tasknotes / ensureFolderExists

Method ensureFolderExists

tests/__mocks__/obsidian.ts:136–154  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

134
135 // Folder operations
136 ensureFolderExists(path: string): void {
137 if (!path) return;
138
139 const normalizedPath = this.normalizePath(path);
140 if (this.folders.has(normalizedPath)) return;
141
142 const parentPath = this.getParentPath(normalizedPath);
143 if (parentPath) {
144 this.ensureFolderExists(parentPath);
145 }
146
147 const folder: MockFolder = {
148 path: normalizedPath,
149 name: this.getFileName(normalizedPath),
150 children: new Map(),
151 };
152
153 this.folders.set(normalizedPath, folder);
154 }
155
156 // Path utilities
157 private normalizePath(path: string): string {

Callers 3

createMethod · 0.95
createFolderMethod · 0.80

Calls 5

normalizePathMethod · 0.95
getParentPathMethod · 0.95
getFileNameMethod · 0.95
hasMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected