MCPcopy Create free account
hub / github.com/Crain99/cc-reverse / copyDir

Function copyDir

scripts/build.js:40–62  ·  view source on GitHub ↗

* 复制目录 * @param {string} src 源目录 * @param {string} dest 目标目录

(src, dest)

Source from the content-addressed store, hash-verified

38 * @param {string} dest 目标目录
39 */
40function copyDir(src, dest) {
41 // 确保目标目录存在
42 fs.mkdirSync(dest, { recursive: true });
43
44 // 读取源目录
45 const files = fs.readdirSync(src);
46
47 for (const file of files) {
48 const srcPath = path.join(src, file);
49 const destPath = path.join(dest, file);
50
51 // 获取文件状态
52 const stat = fs.statSync(srcPath);
53
54 if (stat.isDirectory()) {
55 // 递归复制子目录
56 copyDir(srcPath, destPath);
57 } else {
58 // 复制文件
59 copyFile(srcPath, destPath);
60 }
61 }
62}
63
64/**
65 * 构建项目

Callers 1

buildFunction · 0.85

Calls 1

copyFileFunction · 0.70

Tested by

no test coverage detected