diff --git a/src/utils/fileUtils.js b/src/utils/fileUtils.js index 82aa0aa..b85863a 100644 --- a/src/utils/fileUtils.js +++ b/src/utils/fileUtils.js @@ -1,11 +1,13 @@ const fs = require('fs'); +const path = require('path'); const LATEST_DATA_ONLY = process.env.LATEST_DATA_ONLY == true; // 创建目录 async function createFolder(folderToCreate) { - let currentFolder = folderToCreate.replace(/\\/g, '/'); - let parentFolder = currentFolder.substring(0, currentFolder.lastIndexOf('/')); + let currentFolder = path.join(folderToCreate); + let parentFolder = path.join(currentFolder, '../'); + // console.log({ currentFolder: currentFolder, parentFolder: parentFolder }); if (!fs.existsSync(currentFolder)) { // 文件夹不存在,创建文件夹 createFolder(parentFolder); // 保证父级文件夹存在