修復創建文件夾時連文件名字也被創建
This commit is contained in:
4
index.js
4
index.js
@@ -1,5 +1,5 @@
|
||||
import fs from "fs"
|
||||
import { join } from "path"
|
||||
import { join, dirname } from "path"
|
||||
|
||||
process.stdin.setEncoding("utf8");
|
||||
|
||||
@@ -27,7 +27,7 @@ async function main() {
|
||||
let hash = objects[element].hash;
|
||||
let distfilepath = join(distpath, element);
|
||||
if (!fs.existsSync(distfilepath)) {
|
||||
fs.mkdirSync(distfilepath, { recursive: true });
|
||||
fs.mkdirSync(dirname(distfilepath), { recursive: true });
|
||||
}
|
||||
fs.renameSync(join(srcpath, hash.substring(0, 2), hash), distfilepath);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user