Skip to content

Commit 3fd6493

Browse files
committed
Avoid symlinking files
1 parent 2afc3fd commit 3fd6493

File tree

1 file changed

+2
-43
lines changed

1 file changed

+2
-43
lines changed

index.js

+2-43
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ import moxygen from "moxygen";
22
import assign from "object-assign";
33
import { program } from "commander";
44
import fs from "fs";
5-
import path from "path";
65
import doxygen from "doxygen";
76

87
const TEMPLATES_FOLDER = "./templates/cpp"
98
const XML_FOLDER = "./build/xml/"
10-
const SOURCE_SHADOW_FOLDER = "./source"
119
const PROGRAMMING_LANGUAGE = "cpp"
1210
const DOXYGEN_FILE_PATH = "./doxygen.config"
1311
const ACCESS_LEVEL = "public"
@@ -38,42 +36,6 @@ const cleanDirectory = (dir) => {
3836
}
3937
}
4038

41-
const findAllFiles = (dir, fileExtensions, include, exclude) => {
42-
const files = fs.readdirSync(dir)
43-
let result = []
44-
files.forEach(file => {
45-
const path = dir + "/" + file
46-
const stat = fs.statSync(path)
47-
if (stat && stat.isDirectory()) {
48-
result = result.concat(findAllFilesRecursively(path, include, exclude))
49-
} else {
50-
// Get file extension including the dot
51-
const fileExtension = file.substring(file.lastIndexOf(".")).toLowerCase()
52-
53-
// Only consider files with the given extensions from the fileExtensions array
54-
if (fileExtensions && !fileExtensions.includes(fileExtension)) {
55-
return
56-
}
57-
58-
if (include && !file.match(include)) {
59-
return
60-
}
61-
if (exclude && file.match(exclude)) {
62-
return
63-
}
64-
result.push(path)
65-
}
66-
})
67-
return result
68-
}
69-
70-
const symlinkFilesTo = (files, target, baseDirectory) => {
71-
for (const file of files) {
72-
// The target path should be the base directory + the file path relative to the base directory
73-
const targetFile = target + "/" + path.relative(baseDirectory, file)
74-
fs.symlinkSync(file, targetFile)
75-
}
76-
}
7739

7840
// Get version from package.json without using require
7941
const version = JSON.parse(fs.readFileSync('package.json')).version;
@@ -106,11 +68,8 @@ if (includeCppFiles) {
10668
fileExtensions.push(".cpp")
10769
}
10870

109-
const files = findAllFiles(sourceFolder, fileExtensions , commandOptions.include, commandOptions.exclude)
110-
cleanDirectory(SOURCE_SHADOW_FOLDER)
11171
cleanDirectory("./build")
112-
createDirectories([SOURCE_SHADOW_FOLDER, "./build/md"])
113-
symlinkFilesTo(files, SOURCE_SHADOW_FOLDER, sourceFolder)
72+
createDirectories(["./build/md"])
11473

11574
if(!doxygen.isDoxygenExecutableInstalled()) {
11675
console.log("Doxygen is not installed. Downloading Doxygen...")
@@ -123,7 +82,7 @@ if(!doxygen.isDoxygenExecutableInstalled()) {
12382

12483
// Create doxygen config file. XML output is required for moxygen
12584
const doxyFileOptions = {
126-
INPUT: SOURCE_SHADOW_FOLDER,
85+
INPUT: sourceFolder,
12786
RECURSIVE: "YES",
12887
GENERATE_HTML: "NO",
12988
GENERATE_LATEX: "NO",

0 commit comments

Comments
 (0)