-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopyWrlFiles.js
More file actions
26 lines (22 loc) · 771 Bytes
/
copyWrlFiles.js
File metadata and controls
26 lines (22 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const fs = require('fs');
const path = require('path');
function copyWrlFiles(importTmpPath, projectPath, projectName) {
const sourceDir = path.join(importTmpPath, '.3dshapes');
const targetDir = path.join(projectPath, `${projectName}.3dshapes`);
// Create target directory if it doesn't exist
if (!fs.existsSync(targetDir)) {
fs.mkdirSync(targetDir, { recursive: true });
}
// Copy all .wrl files
if (fs.existsSync(sourceDir)) {
const files = fs.readdirSync(sourceDir);
files.forEach(file => {
if (file.endsWith('.wrl')) {
const sourcePath = path.join(sourceDir, file);
const targetPath = path.join(targetDir, file);
fs.copyFileSync(sourcePath, targetPath);
}
});
}
}
module.exports = copyWrlFiles;