MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / copyDirRecursive

Function copyDirRecursive

apps/desktop/main/utils/pathUtils.ts:108–122  ·  view source on GitHub ↗
(src: string, dest: string, ensureDir: (dirPath: string) => void)

Source from the content-addressed store, hash-verified

106 * 递归复制目录
107 */
108export function copyDirRecursive(src: string, dest: string, ensureDir: (dirPath: string) => void): void {
109 ensureDir(dest)
110 const entries = fs.readdirSync(src, { withFileTypes: true })
111
112 for (const entry of entries) {
113 const srcPath = path.join(src, entry.name)
114 const destPath = path.join(dest, entry.name)
115
116 if (entry.isDirectory()) {
117 copyDirRecursive(srcPath, destPath, ensureDir)
118 } else {
119 fs.copyFileSync(srcPath, destPath)
120 }
121 }
122}
123
124export interface CopyStats {
125 copied: number

Callers 2

migrateDirectoryFunction · 0.90
copyDirMergeFunction · 0.85

Calls 1

ensureDirFunction · 0.50

Tested by

no test coverage detected