Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit a269256

Browse files
committed
index.js: adjust copy order and make sure copy asserts everytime
Signed-off-by: Huang Rui <vowstar@gmail.com>
1 parent 796771d commit a269256

File tree

3 files changed

+1044
-527
lines changed

3 files changed

+1044
-527
lines changed

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ function processBlock(blk) {
7474
// Copy images to output folder every time
7575
var output = book.output;
7676
var rootPath = output.root();
77-
var destFilePath = path.join(rootPath, ASSET_PATH);
78-
if (fs.existsSync(ASSET_PATH)) {
79-
if (!fs.existsSync(destFilePath)) {
80-
fs.mkdirSync(path.join(rootPath, ASSET_PATH), { recursive: true });
81-
}
77+
var destFilePath = path.join(rootPath, assetPath);
78+
if (fs.existsSync(assetPath)) {
8279
// NOTE: fix https://github.com/vowstar/gitbook-plugin-uml/issues/22
8380
// When destFilePath exist, file should copied
8481
if (fs.existsSync(destFilePath)) {
85-
fs.copySync(ASSET_PATH, path.join(rootPath, ASSET_PATH));
82+
fs.copySync(assetPath, path.join(rootPath, assetPath));
83+
} else {
84+
fs.mkdirSync(path.join(rootPath, assetPath), { recursive: true });
85+
fs.copySync(assetPath, path.join(rootPath, assetPath));
8686
}
8787
} else {
8888
console.error("File not exist:" + filePath);

0 commit comments

Comments
 (0)